This year, some contestants at the Memorial Contest ABC are friends with each other (friendship is always mutual). For each contestant $X$, let $t(X)$ be the total score that this contestant achieved in previous years before this contest. It is known that the following statements are true:
$1)$ For any two friends $X'$ and $X''$, we have $t(X') \neq t(X''),$
$2)$ For every contestant $X$, the set $\{ t(Y) : Y \text{ is a friend of } X \}$ consists of consecutive integers.
The organizers want to distribute the contestants into contest halls in such a way that no two friends are in the same hall. What is the minimal number of halls they need?
1. **Graph Representation**:
   - Consider a graph \( G \) where each vertex represents a contestant.
   - There is an edge between two vertices \( A \) and \( B \) if and only if the contestants \( A \) and \( B \) are friends.
   - Each vertex \( A \) is assigned a value \( t(A) \), which is the total score that contestant \( A \) achieved in previous years before this contest.

2. **Proving the Graph is Acyclic**:
   - We need to prove that the graph \( G \) has no cycles.
   - Suppose, for the sake of contradiction, that there is a cycle in the graph. Let this cycle be \( u_1, u_2, \ldots, u_k \).
   - By the properties given, for any two friends \( X' \) and \( X'' \), \( t(X') \neq t(X'') \). This implies that all \( t(u_i) \) values in the cycle are distinct.
   - Additionally, for every contestant \( X \), the set \( \{ t(Y) : Y \text{ is a friend of } X \} \) consists of consecutive integers.

3. **Contradiction in the Cycle**:
   - In a cycle \( u_1, u_2, \ldots, u_k \), there must exist an index \( i \) such that \( t(u_{i-1}) < t(u_i) < t(u_{i+1}) \) (or the reverse order).
   - However, by condition (2), there must be a friend \( v \) of \( u_i \) such that \( t(v) = t(u_i) \), which contradicts condition (1) that \( t(X') \neq t(X'') \) for any two friends \( X' \) and \( X'' \).

4. **Conclusion on Graph Structure**:
   - Since the assumption of a cycle leads to a contradiction, the graph \( G \) must be acyclic.
   - An acyclic graph with no odd cycles is a bipartite graph. This means the graph can be colored using two colors such that no two adjacent vertices share the same color.

5. **Minimal Number of Halls**:
   - Since the graph is bipartite, we can partition the vertices into two sets where no two friends (connected vertices) are in the same set.
   - Therefore, the minimal number of halls required is 2.

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