Suppose that a sequence $(a_n)_{n=1}^{\infty}$ of integers has the following property: For all $n$ large enough (i.e. $n \ge N$ for some $N$ ), $a_n$ equals the number of indices $i$, $1 \le i < n$, such that $a_i + i \ge n$. Find the maximum possible number of integers which occur infinitely many times in the sequence.
1. **Define the Set \( S_n \)**:
   We start by defining the set \( S_n \) as follows:
   \[
   S_n = \{ i : 1 \leq i < n, a_i + i \geq n \}
   \]
   By the problem's condition, we have:
   \[
   a_n = |S_n|
   \]

2. **Boundedness of the Sequence**:
   We claim that the sequence \( (a_n) \) is bounded. To prove this, let:
   \[
   M = \max\{a_1, a_2, \ldots, a_N\}
   \]
   Consider \( a_{N+1} \):
   \[
   a_{N+1} = |\{ i : 1 \leq i \leq N, a_i + i \geq N+1 \}|
   \]
   If \( i_0 \notin S_N \), then \( a_{i_0} + i_0 < N \), hence \( i_0 \notin S_{N+1} \). Therefore:
   \[
   |S_{N+1}| \leq |S_N| + 1
   \]
   If \( a_N \leq M-1 \), there is nothing to prove. Assume \( a_N = M \). Since \( N-1 \geq a_N = M \), we have \( M = N - d \) for some \( d \). Thus:
   \[
   a_i \leq N - d \quad \text{for every} \quad i \in \{1, 2, \ldots, N-1\}
   \]
   For \( i = 1, 2, \ldots, d-1 \):
   \[
   a_i + i \leq a_i + d - 1 \leq N - d + d - 1 < N
   \]
   Hence, \( i \notin S_N \). The only members of \( S_N \) can be among \( i = d, d+1, \ldots, N-1 \). Since \( d = N - M \) and \( |S_N| = M \), we have:
   \[
   \{d, d+1, \ldots, N-1\} = S_N
   \]
   Therefore:
   \[
   a_{N-M} + (N-M) \geq N \implies a_{N-M} \geq M
   \]
   Combining this with \( a_{N-M} \leq M \), we get:
   \[
   a_{N-M} = M
   \]
   Hence, \( N-M \notin S_{N+1} \), and therefore:
   \[
   |S_{N+1}| \leq |S_N| = M
   \]
   Using these ideas, the sequence is bounded.

3. **Periodicity of the Sequence**:
   We claim that the sequence is periodic. Since \( a_n \leq M \) for every \( n \), for any \( \ell \) sufficiently large, \( a_{\ell} \) depends only on the indices \( i = \ell-1, \ell-2, \ldots, \ell-M \). For \( i \leq \ell - M - 1 \):
   \[
   a_i + i \leq \ell - M - 1 + M = \ell - 1 < \ell
   \]
   Hence, \( i \notin S_\ell \). The only indices that matter are those in \( \ell-1, \ell-2, \ldots, \ell-M \). Consider \( M^M \) blocks of terms, \( B_1, B_2, \ldots, B_{M^M} \), where each block consists of \( M \) terms of the sequence. By the Pigeonhole Principle, the next block of terms must be one of \( B_i \), and from there onwards, the sequence is periodic.

4. **Values of the Sequence**:
   Suppose the sequence is periodic after \( L \), and redefine \( M \) as:
   \[
   M = \max\{a_i : i \leq L\}
   \]
   Take \( i_0 \) such that \( a_{i_0} = M \). We have:
   \[
   i_0 - M, i_0 - M + 1, \ldots, i_0 - 1 \in S_{i_0}
   \]
   Hence:
   \[
   a_{i_0 - M} + (i_0 - M) \geq i_0 \implies a_{i_0 - M} \geq M
   \]
   Since \( M \geq a_{i_0 - M} \), we get:
   \[
   a_{i_0 - M} = M
   \]
   If \( a_n = M \), then:
   \[
   a_{n+M} = M
   \]

5. **Sequence Values \( M \) and \( M-1 \)**:
   We will show that the sequence can only take the values \( M \) and \( M-1 \) from some point onwards. Assume there is a term in the sequence that is less than \( M-1 \). Consider a pair \( (k, n) \) with \( a_n = M \) and \( a_k < M-1 \) with the smallest \( k-n \). We have \( a_k < M-1 \). We claim that \( a_{k-1} < M \). Suppose \( a_{k-1} = M \). From the previous paragraph:
   \[
   a_{k+M-1} = M
   \]
   However, \( a_{k+M-1} \) depends on the terms \( a_{k+M-2}, \ldots, a_{k-1} \). Hence, \( k \in S_{k+M-1} \). However:
   \[
   a_k + k < M + k - 1
   \]
   Hence, \( k \notin S_{k+M-1} \), contradiction. Therefore, \( a_{k-1} < M \) and \( a_k < M-1 \). We now inspect \( a_{k+M-1} \). Note that \( a_{k+M-1} \) depends on \( a_{k+M-2}, \ldots, a_{k-1} \). Now:
   \[
   a_{k-1} + k - 1 < M + k - 1
   \]
   Hence, \( k-1 \notin S_{k+M-1} \). Furthermore:
   \[
   a_k + k < M - 1 + k
   \]
   Hence, \( k \notin S_{k+M-1} \). Therefore:
   \[
   a_{k+M-1} \leq M-2 < M-1
   \]
   This gives \( a_{k+M-1} < M-1 \) and \( a_{n+M} = M \). For this pair, \( k+M-1-(n+M) = k-n-1 < k-n \), contradicting the earlier choice. We are done.

Therefore, the sequence can take at most two distinct values infinitely often. Finally, we construct an example. Take \( a_1 = \cdots = a_{N-3} = 0 \), \( a_{N-2} = 2 \), and \( a_{N-1} = 1 \). Then:
\[
a_N = 2, \quad a_{N+1} = 1, \quad a_{N+2} = 2, \quad \text{and so on}
\]
Thus, this sequence has the desired property.

The final answer is \( \boxed{ 2 } \).