Solution. By adding and subtracting $2-n$ to the numerator, we obtain

$$
a_{n}=\frac{n^{2}-2}{n^{2}-n+2}=\frac{n^{2}-2-n+2+n-2}{n^{2}-n+2}=1+\frac{n-4}{n^{2}-n+2}
$$

Now let's see if there are two equal terms, that is, when $a_{p}=a_{q}$ for $p \neq q$. This is equivalent to finding integers $p \neq q$ for which

$$
\begin{gathered}
\frac{p-4}{p^{2}-p+2}=\frac{q-4}{q^{2}-q+2} \Leftrightarrow(p-q)(p q-4 p-4 q+2)=0 \\
p q-4 p-4 q+2+14=14 \Leftrightarrow(p-4)(q-4)=14
\end{gathered}
$$

From the above, it follows that $(p-4) \mid 14$ and $p-4 \in\{ \pm 1, \pm 2, \pm 7, \pm 14\}$. Negative values are not possible because both $p, q \geq 1$, so $p-4 \in\{1,2,7,14\}$. Since $(p-4)(q-4)=14$, then $q-4 \in\{14,7,2,1\}$, which results in the pairs $(p, q)=(5,18)$ and $(p, q)=(6,11)$ for which $a_{5}=\frac{22}{23}=a_{18}$ and $a_{6}=\frac{17}{16}=a_{11}$. Finally, since all $a_{n}$ are rational numbers, among the first 100 terms of the sequence, there are 98 that are distinct.
1. Determine the number of distinct values of the expression

$$
\frac{n^{2}-2}{n^{2}-n+2}
$$

where $n \in\{1,2, \ldots, 100\}$.