How to count the number of elments in a group generated by $2$ elements? Say we consider $a = (13)(24)$ and $b=(234)$ in $S_n$. 

How can I find the number of elements in the group generated by $a$
  and $b$?

I am looking for an intelligent way. So far I have multiplied together all possible pairs and got $b, b^2, a, ab, ba, ab^2, b^2a$ and they are all different. But unless I keep multiplying I cannot be sure I found them all.
This question came up when I was solving this exercise here:
Label the four locations of tires on an automobile with the labels $ 1,2,3 $ and $4$, clockwise. Let $a$ represent the operation of switching the tires in positions $1$ and $3$ and switching the tires in positions $2$ and $4$. Let $b$ represent the operation of rotating the tires in positions 2,3, and 4 clockwise and leaving the tire in position $1$ as is. Let $G$ be the group of all possible combinations of a and b. How many elements are in $G$?
Edit
This question comes before Lagrange's theorem is mentionend.
 A: The permutations $a$ and $b$ are both even. Therefore the group generated by $a$ and $b$ has at most $12$ elements. The subgroup generated by $b$ has three elements. If you can find a subgroup of order $4$, then Lagrange's Theorem will tell you the answer is $12$. But $\{e,a,bab^{-1},b^2 a b^{-2}\}$ is such a subgroup. (Alternatively, you have already found seven distinct elements. The only divisor of 12 that is $\geq 7$ is 12 itself.)
Edit By request, here is an alternative proof not using Lagrange's Theorem. Let $H$ be the subgroup of $S_4$ generated by $a$ and $b$. Since $a, b \in A_4$, we have $H \subseteq A_4$. Let $K = \{e, (1 2)(3 4), (1 3)(2 4), (1 4)(2 3)\}$. It is easy to see that $K$ is a subgroup of $A_4$. We have $K = \{e, a, bab^{-1}, b^2 a b^{-2}\} \subseteq H$. We will prove that the elements $b^i k$, where $k \in K$ and $i = 0, 1, 2$, are all distinct. There are twelve such elements, and they all belong to $H$, so this proves that $H = A_4$.
To prove the claim, assume that $b^{i_1} k_1 = b^{i_2} k_2$. Then $b^{i_2 - i_1} = k_2 k_1^{-1} \in K$. But the only power of $b$ that belongs to $K$ is $e$, so $b^{i_2 - i_1} = e$. Since $0 \leq i_1, i_2 \leq 2$ and $b, b^2 \ne e$, this implies $i_1 = i_2$.
