I did the below codes using GAP to find out that $n$. We know that if $G$ wants to have an element of order $n$ so $n\mid |G|$. Here, $|G|=5!=120$, so the following numbers are its dividing factors:
$$1,~ 2,~ 3,~ 4,~ 5,~ 6,~ 8,~ 10,~ 12,~ 15,~ 20,~ 24,~ 30,~ 40,~ 60,~ 120$$
gap> e:=Elements(SymmetricGroup(IsPermGroup,5));;
k:=DivisorsInt(120);;
for i in k do Print("The following elements are of order"," ", "i=",
i,":",Filtered(e,t->Order(t)=i),"\n");
od;
Output:
The following elements are of order i=2:
[ (4,5), (3,4), (3,5), (2,3), (2,3)(4,5), (2,4), (2,4)(3,5), (2,5),
(2,5)(3,4), (1,2), (1,2)(4,5), (1,2)(3,4), (1,2)(3,5), (1,3), (1,3)(4,5),
(1,3)(2,4), (1,3)(2,5), (1,4), (1,4)(3,5), (1,4)(2,3), (1,4)(2,5), (1,5),
(1,5)(3,4), (1,5)(2,3), (1,5)(2,4) ]
The following elements are of order i=4:
[ (2,3,4,5), (2,3,5,4), (2,4,5,3),
(2,4,3,5), (2,5,4,3), (2,5,3,4), (1,2,3,4), (1,2,3,5), (1,2,4,3),
(1,2,4,5), (1,2,5,3), (1,2,5,4), (1,3,4,2), (1,3,5,2), (1,3,4,5),
(1,3,5,4), (1,3,2,4), (1,3,2,5), (1,4,3,2), (1,4,5,2), (1,4,5,3),
(1,4,3,5), (1,4,2,3), (1,4,2,5), (1,5,3,2), (1,5,4,2), (1,5,4,3),
(1,5,3,4), (1,5,2,3), (1,5,2,4) ]
The following elements are of order i=6:
[ (1,2)(3,4,5), (1,2)(3,5,4), (1,2,3)(4,5), (1,2,4)(3,5), (1,2,5)(3,4),
(1,3,2)(4,5), (1,3)(2,4,5), (1,3,5)(2,4), (1,3)(2,5,4), (1,3,4)(2,5),
(1,4,2)(3,5), (1,4,5)(2,3), (1,4)(2,3,5), (1,4,3)(2,5), (1,4)(2,5,3),
(1,5,2)(3,4), (1,5,4)(2,3), (1,5)(2,3,4), (1,5,3)(2,4), (1,5)(2,4,3) ]
The following elements are of order i=8:[ ]
The following elements are of order i=10:[ ]
The following elements are of order i=12:[ ]
The following elements are of order i=15:[ ]
The following elements are of order i=20:[ ]
The following elements are of order i=24:[ ]
The following elements are of order i=30:[ ]
The following elements are of order i=40:[ ]
The following elements are of order i=60:[ ]
The following elements are of order i=120:[ ]