You know (I hope) that the center is a normal subgroup of $G $ then if you have that your group is simple you get that it's center must be trivial, either $G$ ( if $G$is abelian) or the identity element $e $.
We know $A_n $ is not abelian so it's center is not the whole group, as $A_n $ is simple for $n>4$ (you may google this fact if you don't knew about it) for $n>4$ $Z (A_n)$ has only one element, the identity.
Now we must check the cases $n=1,2,3,4$.
For $n=1$ the center is equal to the identity because the whole group is the identity.
For $n=2$ it only contains the identity because the group has only the identity element.
For $n=3$ it's easy to see that there is more than one element in the center, because $A_3 $ has order $3$ so it is a p-group.
For $n=4$ you may check that has trivial center easily. (Suppose there is an element that conmutes with every other element and get a contradiction).
Then we conclude that we must have $n=3$.
Hope it helps.