There are $n$ boys and $n$ girls sitting around a circular table, where $n>3$. In every move, we are allowed to swap
the places of $2$ adjacent children. The [b]entropy[/b] of a configuration is the minimal number of moves
such that at the end of them each child has at least one neighbor of the same gender.

Find the maximal possible entropy over the set of all configurations.

[i]Proposed by Viktor Simjanoski[/i]

1. **Claim**: The maximal possible entropy is \( \boxed{n-2} \).

2. **Configuration to Achieve Entropy**:
   - Place the children around the table in the following order:
     - 1 boy (Bob)
     - \(\left\lfloor \frac{n-1}{2} \right\rfloor\) girls (block G1)
     - \(\left\lceil \frac{n-1}{2} \right\rceil\) boys (block B2)
     - 1 girl (Alice)
     - \(\left\lfloor \frac{n-1}{2} \right\rfloor\) boys (block B1)
     - \(\left\lceil \frac{n-1}{2} \right\rceil\) girls (block G2)

3. **Proof of Entropy**:
   - **Case 1: \( n \) is even**:
     - Alice swaps places with each boy from B1.
     - Bob swaps places with each girl from G1.
   - **Case 2: \( n \) is odd**:
     - The girl from G1 closest to Alice swaps places with each boy from B2 consecutively.
     - Bob swaps places with everyone remaining in G1.

4. **Lower Bound on Moves**:
   - Define \( m_A \) as the minimal number of swaps Alice needs to perform to land next to a girl neighbor.
   - Define \( m_B \) similarly for Bob.
   - If \( n \) is even, \( m_A + m_B = n-2 \) initially, and at any point, we can decrease either \( m_A \) or \( m_B \) by at most one, but never both simultaneously.
   - If \( n \) is odd, \( m_A + m_B = n-1 \) initially, and at each turn, we can decrease \( m_A \) and \( m_B \) by at most 1, and can decrease both simultaneously only with the first swap.

5. **Definitions**:
   - **Block**: A group of people of the same gender sat consecutively around the table.
   - **Island**: A block containing only one person.
   - **Run**: A series of two or more islands that are sat consecutively around the table.
   - **Resolve**: Perform a series of swaps that bring every person from the group next to a neighbor of the same gender.

6. **Lemma**: Let a given run contain \( g \) girls. Then, it can be resolved in at most \( g \) steps.
   - **Proof**: Swap the first two people in the run and apply induction on the remaining part of the run. \( \blacksquare \)

7. **Case Analysis**:
   - **Case 1: At most three boy blocks**:
     - Resolve in at most \( n-2 \) steps by directly moving the islands towards another island of the same gender, if it exists, and to a block of the same gender if it doesn't.
   - **Case 2: Only islands around the table**:
     - Resolve in \( \left\lceil \frac{n}{2} \right\rceil \) steps by going around the circle and greedily swapping pairs of consecutive islands when encountered.

8. **General Case**:
   - Assume at least 4 distinct boy regions, not all of which are islands.
   - **Gender_Connect Algorithm (GC)**:
     - Starting from a non-island boy region and going clockwise, enumerate the girl regions encountered \( 1, 2, \ldots \), and let the \( i \)-th girl region consist of \( a_i \) girls.
     - Let \( A = \{i \mid \text{girl region } i \text{ neighbors at least one boy island and } i \text{ is even}\} \) and \( B = \{i \mid \text{girl region } i \text{ neighbors at least one boy island and } i \text{ is odd}\} \).
     - Let \( S_1 = \sum_{i \in A} a_i \) and \( S_2 = \sum_{i \in B} a_i \).
     - Since \( S_1 + S_2 \leq n \), at least one of them must be \( \leq \frac{n}{2} \).
     - Move the boy islands through whichever of the two girl regions it neighbors is a part of the smaller \( S_j \).

9. **Application of GC**:
   - Apply GC twice: first to the gender requiring fewer steps, then to the other.
   - **Case 1: \( n \) is even and the first GC does \( n/2 \) moves**:
     - All girl regions, and thus all girl islands, neighbor at least one boy island.
     - Resolve every run in \( \leq n-2 \) moves by the Lemma.
   - **Case 2: \( n \) is even, the first GC takes \( n/2-1 \) moves, and the second \( n/2 \) moves**:
     - Resolve remaining runs using the Lemma.
   - **Case 3: \( n \) is odd and both GCs take \( (n-1)/2 \) moves**:
     - Adjust the GC to shorten the series of moves by one, bringing the total number of moves down to \( n-2 \).

Thus, every configuration can be resolved in at most \( n-2 \) steps. \( \blacksquare \)