We are given the following function $f$, which takes a list of integers and outputs another list of integers. (Note that here the list is zero-indexed.)

\[
\begin{array}{l}
1: \textbf{FUNCTION} \ f(A) \\
2: \quad \textbf{FOR} \ i=1,\ldots, \operatorname{length}(A)-1: \\
3: \quad\quad A[i]\leftarrow A[A[i]] \\
4: \quad\quad A[0]\leftarrow A[0]-1 \\
5: \quad \textbf{RETURN} \ A
\end{array}
\]

Suppose the list $B$ is equal to $[0,1,2,8,2,0,1,7,0]$. In how many entries do $B$ and $f(B)$ differ?

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