Bethan is playing a game on an $n\times n$ grid consisting of $n^2$ cells. A move consists of placing a counter in an unoccupied cell $C$ where the $2n-2$ other cells in the same row or column as $C$ contain an even number of counters. After making $M$ moves Bethan realises she cannot make any more moves. Determine the minimum value of $M$.

[i]United Kingdom, Sam Bealing[/i]
1. **Understanding the Problem:**
   Bethan is playing a game on an \( n \times n \) grid. A move consists of placing a counter in an unoccupied cell \( C \) where the \( 2n-2 \) other cells in the same row or column as \( C \) contain an even number of counters. After making \( M \) moves, Bethan realizes she cannot make any more moves. We need to determine the minimum value of \( M \).

2. **Initial Observations:**
   - For a cell \( C \) to be playable, the number of counters in its row and column must both be even.
   - We need to find the minimum number of moves \( M \) such that no more moves can be made.

3. **Case 1: \( n \) is odd**
   - Consider the configuration where we have one \(\left(\frac{n+1}{2}\right) \times \left(\frac{n+1}{2}\right)\) square of counters and one \(\left(\frac{n-1}{2}\right) \times \left(\frac{n-1}{2}\right)\) square of counters.
   - Each empty square will have exactly \( n \) counters in the same row or column, making it unplayable.
   - The number of counters in this configuration is:
     \[
     M = \left(\frac{n+1}{2}\right)^2 + \left(\frac{n-1}{2}\right)^2 = \frac{(n+1)^2}{4} + \frac{(n-1)^2}{4} = \frac{n^2 + 1}{2}
     \]

4. **Case 2: \( n \) is even**
   - Let \(\{x, y\} = \left\{\frac{n}{2}, \frac{n}{2} + 1\right\}\) where \( x \) is odd.
   - Consider the configuration with an \( x \times x \) square of counters and a \( y \times y \) square of counters overlapping at one cell.
   - Each empty square will have exactly \( x + y \) counters in the same row or column, which is an odd number, making it unplayable.
   - The number of counters in this configuration is:
     \[
     M = x^2 + y^2 - 1 = \left(\frac{n}{2}\right)^2 + \left(\frac{n}{2} + 1\right)^2 - 1 = \frac{n^2}{4} + \frac{n^2}{4} + \frac{n}{2} + \frac{n}{2} + 1 - 1 = \frac{n^2}{2} + n
     \]

5. **Proving Optimality:**
   - We need to show that these configurations are optimal.
   - Define a square as playable if the other \( 2n-2 \) cells in its row and column contain an even number of tokens.
   - A square is playable if and only if its row and column are either both odd or both even.
   - Let \( c_O, c_E \) denote the number of odd/even columns and \( r_O, r_E \) denote the number of odd/even rows.
   - We claim \( c_O = r_O \) after any sequence of moves. This is true initially and preserved by each move.
   - The number of playable squares is \( P = c_O r_O + c_E r_E = c_O^2 + c_E^2 \).

6. **Final Configuration Analysis:**
   - For odd \( n \):
     \[
     c_O + c_E = n \implies P \geq \left(\frac{n+1}{2}\right)^2 + \left(\frac{n-1}{2}\right)^2
     \]
   - For even \( n \):
     - If \( c_O, c_E \) are both odd, the number of tokens is at least \( P + c_E + r_E = P + 2c_E \).
     - If \( c_O, c_E \) are both even, the number of tokens is at least \( P + c_O + r_O = P + 2c_O \).
     - Thus, \( M \geq c_O^2 + c_E^2 + 2 \min(c_O, c_E) \).
     - Let \(\{c_O, c_E\} = \left\{\frac{n}{2} + x, \frac{n}{2} - x\right\}\) where \( x \) is a non-negative integer:
       \[
       M \geq \left(\frac{n}{2} + x\right)^2 + \left(\frac{n}{2} - x\right)^2 + 2\left(\frac{n}{2} - x\right) = \frac{n^2}{2} + n + 2x(x-1) \geq \frac{n^2}{2} + n
       \]

The final answer is \( \boxed{M = \frac{n^2 + 1}{2}} \) if \( n \) is odd and \( \boxed{M = \frac{n^2}{2} + n} \) if \( n \) is even.