Let's take an example. Consider set $S=\{1,2,3,4,5,6,7\}$ and let's take n=3.
For all $a\in A, a-a=0,$ so R is reflexive.
For $a,b\in A, a-b=3c,$ for some $c\in Z\Rightarrow b-a=3(-c),$ for $-c\in Z,$ so $aRb\Rightarrow bRa$ and R is symmetric.
If $a,b,c\in A$ and $aRb,bRc,$ then $a-b=3m, b-c=3n,$ for some $m,n\in Z\Rightarrow (a-b)+(b-c)=3m+3n\Rightarrow a-c=3(m+n),$ so aRc. Consequently, R is transitive.
Equivalence classes for n=3
$[1]=[4]=[7]=\{1,4,7\}; [2]=[5]=\{2,5\}; [3]=[6]=\{3,6\}.$
$S=\{1,4,7\}\cup \{2,5\} \cup \{3,6\}$
Similarly you can approach for n=5.