There is a school with $n$ students. Suppose that every student has exactly $2023$ friends and every couple of student that are not friends has exactly $2022$ friends in common. Then find all values of $n$
1. **Restate the problem in terms of graph theory:**
   - Let \( G \) be a graph where each vertex represents a student.
   - Each vertex has exactly \( 2023 \) edges (friends).
   - Any two non-adjacent vertices have exactly \( 2022 \) common neighbors.

2. **Generalize the problem:**
   - Replace \( 2023 \) with \( 2k+1 \).
   - Let \( n \) be the number of vertices (students).
   - We need to find \( n \) such that the conditions hold.

3. **Base cases:**
   - For \( k = 0 \), each student has \( 1 \) friend, and any two non-friends have \( 0 \) common friends. This is trivially satisfied by \( n = 2 \).
   - For \( k = 1 \), each student has \( 3 \) friends, and any two non-friends have \( 2 \) common friends. This is satisfied by \( n = 4 \).

4. **Inductive step:**
   - Assume the hypothesis holds for \( k = 0, 1, \ldots, m-1 \).
   - Prove it for \( k = m \).

5. **Case 1: All students are friends with each other:**
   - There are \( 2m+2 \) students.
   - The complete graph \( K_{2m+2} \) satisfies the conditions.
   - \( 2m+2 - 2m \) is even and divides \( 2m \).

6. **Case 2: Students \( A \) and \( B \) are not friends:**
   - They have \( 2m \) common friends \( X_1, \ldots, X_{2m} \).
   - Let \( C \) be another friend of \( A \) and \( D \) be another friend of \( B \).

7. **Subcase 1: \( C \) and \( D \) are friends:**
   - \( C \) and \( B \) have \( 2m \) common friends.
   - \( C \) has a friend \( A \) who is not a friend of \( B \).
   - All other \( 2m-1 \) friends of \( C \) must be from \( \{X_1, \ldots, X_{2m}\} \).
   - Similarly, all other \( 2m-1 \) friends of \( D \) are from the same set.
   - If there is another student \( E \) not in \( \{A, B, C, D, X_1, \ldots, X_{2m}\} \), \( E \) and \( C \) have \( 2m \) common friends.
   - \( C \) has two friends \( A \) and \( D \) who are not friends with \( E \), leading to a contradiction.
   - Hence, there are \( 2m+4 \) students in total.

8. **Subcase 2: \( C \) and \( D \) are not friends:**
   - \( C \) and \( B \) have \( 2m \) common friends.
   - \( B \) has a friend \( D \) who is not a friend of \( C \).
   - All other \( 2m \) friends of \( C \) must be \( X_1, \ldots, X_{2m} \).
   - Similarly, all other \( 2m \) friends of \( D \) are \( X_1, \ldots, X_{2m} \).
   - Let \( G \) be the set of students other than \( \{A, B, C, D, X_1, \ldots, X_{2m}\} \).
   - Let \( E \in G \).
   - \( E \) and \( C \) have \( 2m \) common friends.
   - \( C \) has a friend \( A \) who is not a friend of \( E \).
   - \( E \) must be friends with \( X_1, \ldots, X_{2m} \).
   - All students in \( G \) are friends with \( X_1, \ldots, X_{2m} \) and have exactly one friend in \( G \).
   - Pair up the friends in \( G \).
   - \( |G| = 2r \) where \( r \ge 1 \).
   - There are \( 2m + 2r + 4 \) students in total.

9. **Induction hypothesis:**
   - Remove points from \( G \) and \( \{A, B, C, D\} \).
   - Each remaining student \( X_1, \ldots, X_{2m} \) is friends with all removed students.
   - The new graph satisfies the problem condition for \( k = m - r - 2 \).
   - By induction hypothesis, \( 2m - (2m - 2r - 4) | 2m - 2r - 4 \Rightarrow 2r + 4 | 2m - 2r - 4 \).

10. **Conclusion:**
    - The possible values of \( n \) are \( 2024, 2026, 2028, 2696, 4044 \).

The final answer is \( \boxed{ 2024, 2026, 2028, 2696, 4044 } \).