# Modular Power Train

Let $$0<n \leq 50$$ be a positive integer satisfying the relation

$$\Large{\left(\sum_{i=1}^{n} (-1)^{i}\left(i^{i^2} \mod 10\right)\right) \mod 10 = n \mod 10}$$

Find the sum of all the solutions in the range $$0<n \leq 50$$.

×