Number of non-polar contact calculation

GROMACS version:
GROMACS modification: Yes/No

Hello,

Could you please someone help me how to calculate the non-polar contacts within the specific domain of a protein over the simulation time? But I just want to count only one contact for the multiple contacts of a residue with others.