It's (probably) a fairly basic result that the only equivalence relations on $\mathbb{Z}$ that are compatible with the ring operations are congruences modulo $n$ for $n \in \mathbb{Z}$... as it's usually stated without proof in more advanced works on algebra.
(This is a "completeness result"--if you'd like to call it that--of the more elementary fact (in the opposite direction) that congruences modulo $n$ are compatible with the ring operations on $\mathbb{Z}$. The only slightly tricky part of the reverse implication is to prove it for multiplication: $a_1 - a_2 = xn$ and $b_1 - b_2 = yn$ imply that $a_1 b_1 - a_2 b_2 = a_1 (b_1 - b_2) + b_2(a_1-a_2) = (a_1 y + b_2x)n$.)
But to restate the problem at hand here, let $E$ be an equivalence relation on $\mathbb{Z}$ compatible with the ring operations, i.e E is reflexive, transitive, symmetric, and additionally that $a_1Ea_2$ and $b_1Eb_2$ imply that $(a_1+a_2)E(b_1+b_2)$ and $(a_1a_2)E(b_1b_2)$. Prove that there exist $n \in \mathbb{Z}$ such that for all integers $a,b \in \mathbb{Z}$, $aEb$ implies that $a-b = kn$ for some $k \in \mathbb{Z}$.