An easy way to get the number of frames is by using gmx check:
gmx check -f your_traj.xtc
It is recommendable to use the frames where the energy of the system has converged... You can discard a certain number of frames at the beginning of the trajectory... For example, use only the last 10 ns of a 20 ns trajectory...