Tanya wrote numbers in the form $n^7 - 1$ for $n = 2, 3, \ldots$ and noticed that for $n = 8$, she obtained a number divisible by $337$. For what minimal $n$ did she get a number divisible by $2022$?

Let's think step by step and output the final answer within \boxed{}.
user