That's actually not accurate...

The congruence is rather $\displaystyle 5n\equiv831\pmod{83}$.

This is due to the following theorem: Suppose $\displaystyle a $ has

*order $\displaystyle k $* modulo $\displaystyle m $. Then $\displaystyle a^i\equiv a^j\pmod m$ if and only if $\displaystyle i\equiv j\pmod k$.

The order is found among the divisors of $\displaystyle \phi(167)$, those are $\displaystyle 1, 2, 83,$ and $\displaystyle 166 $. In the problem we can find that $\displaystyle 2^{83}\equiv1\pmod {167}$, so the order is $\displaystyle 83 $. (1 or 2 clearly cannot be the orders)

The congruence is reduced to $\displaystyle 5n\equiv1\pmod {83}$... Solving this congruence gives $\displaystyle n\equiv{50}\pmod {83}$.