If I know the order of every element in a group, do I know the group? Suppose $G$ is a finite group and I know for every $k \leq |G|$ that exactly $n_k$ elements in $G$ have order $k$. Do I know what the group is? Is there a counterexample where two groups $G$ and $H$ have the same number of elements for each order, but $G$ is not isomorphic to $H$? I suspect that there is, but I haven't thought of one.
 A: Take $G=\mathbb{Z}/4\times \mathbb{Z}/4$, and $H=Q_8\times \mathbb{Z}/2$ of order $16$, where $Q_8$ denotes the quaternion group. Both groups have exactly $1$ element of order $1$, $3$ elements of order $2$ and $12$ elements of order $4$.
Edit: I understood the question as follows: Is there a counterexample where two groups $G$ and $H$ have the same number of elements for each order, but $G$ is not isomorphic to $H$ ? Is it really required, that all elements different from $1$ in $G$ have the same order ?
A: Here is an example with two groups of order $27$. Consider the group $G$ which is elementary abelian (all elements $x \in G$ satisfy $x^{3} = 1$), of order $27$. And then $H$ the non-abelian group of order $27$ and exponent $3$ (once more, $x^{3} = 1$ for all $x \in H$). Concretely,
$$
\left\{\,
\begin{bmatrix}
1 & a & b\\
0 & 1 & c\\
0 & 0 & 1
\end{bmatrix}
:
a, b, c \in F
\,\right\},
$$
where $F = \mathbb{Z}/ 3 \mathbb{Z}$ is the field with three elements.
A: Let $p$ be an odd prime. Let $G$ be the non-abelian group of matrices of the form $$\begin{pmatrix}1&a&b\\0&1&c\\0&0&1\end{pmatrix}\in\operatorname{GL}(3,\mathbb F_p).$$ Then $|G|=p^3$ and each element $g\ne 1$ has order $p$; this follows from the fact that $g-1$ is nilpotent, hence $(g-1)^p=(g-1)^3=0$ and finally $g^p=(1+(g-1))^p=1^p+(g-q)^p=1$. 
Likewise the abelian group $H=(\mathbb Z/p\mathbb Z)^3$ is also of exponent $p$, i.e., all elements $\ne1$  have order $p$.
As $H$ is abelian and $G$ is not, certainly $G\not\cong H$.
