Finding number of elements of order 2 or 4 
I know in a cyclic group, the number of elements of order $n$ is $\phi(n)$ but I'm not sure what's being done to find it in the direct product.
For example, $\mathbb{Z}_4 \oplus \mathbb{Z}_2 \oplus \mathbb{Z}_2$, there are 7 elements of order 2 and what's done is $\phi(2) * 4 + 3$ but ...why that exactly? Similarly for elements of order 4.
Thanks for any help.
 A: I assume that by $\mathbb Z_n$ you mean the group of integers mod $n$ and addition.
In the following all groups will be of order $2^n$ for some $n \ge 0$.
Let $O(n,G)=$ the number of elements of order $2^n$ in $G$.
Then $O(k,\mathbb Z_{2^n}) = 2^{k-1} \text { for }1\le k \le n \text { and } 0 $ otherwise.  
Theorem:$$O(k,G \oplus H) =O(k,G)\sum_{i=0}^{k}O(i,H)+ O(k,H\sum_{j=0}^{k}O(j,G) -O(k,G)O(k,H)$$
Proof: By counting as follows:
Let $|(g,h)|=2^k$ in $G\oplus H$ then $\max \{|g|, |h|\}=2^k$ so
either $|g|=2^k \text { and } |h| \le 2^k$ or vice versa. The first term in the sum counts the first possibility, the second term counts the vice versa and the third term counts the overlap, if any.   
Answer to posted problem follows from application of Theorem, sequentially if needed. For example:
$O(0,\mathbb Z_{2^3} \oplus \mathbb Z_{2^1}) = 1(1)+1(1)-1(1)=1$
$O(1,\mathbb Z_{2^3} \oplus \mathbb Z_{2^1}) = 1(1+1)+1(1+1)-1(1)=3$ 
$O(2,\mathbb Z_{2^3} \oplus \mathbb Z_{2^1}) = 2(1+1)+0(1+1+2)-2(0)=4$
$O(3,\mathbb Z_{2^3} \oplus \mathbb Z_{2^1}) = 4(1+1)+0(1+1+2+4)-4(0)=8$
For a total of 16 elements.
The Theorem (or some generalization of it) is probably true for an arbitrary prime in place of $2$. I just proved what I needed to answer the question.
