In the figure below, how many ways are there to select two squares which do not share an edge?

[asy]
size(3cm);
for (int t = -2; t <= 2; t=t+1) { draw( shift((t,0))*unitsquare ) ; if (t!=0) draw( shift((0,t))*unitsquare ); }
[/asy]

[i]Proposed by Evan Chen[/i]
1. **Identify the total number of squares**: The figure is a 3x3 grid, so there are \(9\) squares in total.

2. **Calculate the total number of ways to choose 2 squares**: The number of ways to choose 2 squares out of 9 is given by the combination formula \(\binom{n}{k}\), where \(n\) is the total number of items, and \(k\) is the number of items to choose. Thus, we have:
   \[
   \binom{9}{2} = \frac{9 \times 8}{2 \times 1} = 36
   \]

3. **Count the number of ways to choose 2 squares that share an edge**: 
   - **Horizontal pairs**: There are 3 rows, and each row has 2 pairs of adjacent squares. Thus, there are \(3 \times 2 = 6\) horizontal pairs.
   - **Vertical pairs**: Similarly, there are 3 columns, and each column has 2 pairs of adjacent squares. Thus, there are \(3 \times 2 = 6\) vertical pairs.
   - **Total pairs sharing an edge**: Adding the horizontal and vertical pairs, we get \(6 + 6 = 12\).

4. **Calculate the number of ways to choose 2 squares that do not share an edge**: Subtract the number of pairs that share an edge from the total number of ways to choose 2 squares:
   \[
   36 - 12 = 24
   \]

5. **Verify the solution using casework**:
   - **Outer squares**: There are 4 outer squares. If we choose one of these, we can choose another square in 7 ways (since it must not share an edge with the chosen square). Thus, we have:
     \[
     4 \times 7 = 28
     \]
   - **Squares adjacent to the center**: There are 4 squares adjacent to the center. If we choose one of these, we can choose another square in 6 ways (since it must not share an edge with the chosen square). Thus, we have:
     \[
     4 \times 6 = 24
     \]
   - **Center square**: If we choose the center square, we can choose another square in 4 ways (since it must not share an edge with the chosen square). Thus, we have:
     \[
     1 \times 4 = 4
     \]
   - **Total ways**: Adding these, we get:
     \[
     28 + 24 + 4 = 56
     \]
   - **Divide by 2**: Since choosing square \(A\) and square \(B\) is the same as choosing square \(B\) and square \(A\), we must divide by 2:
     \[
     \frac{56}{2} = 28
     \]

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