Find all $(m,n) \in \mathbb{Z}^2$ that we can color each unit square of $m \times n$ with the colors black and white that for each unit square number of unit squares that have the same color with it and have at least one common vertex (including itself) is even.
1. **Define the problem in terms of graph theory:**
   - Consider each unit square on the \(m \times n\) board as a vertex in a graph.
   - Two vertices (squares) are connected by an edge if they share at least one vertex (corner).
   - We need to color the vertices (squares) such that each vertex has an even number of neighbors of the same color.

2. **Analyze the condition for even neighbors:**
   - For each square, the number of neighbors of the same color must be even.
   - This implies that the degree of each vertex in the graph (number of neighbors) must be even.

3. **Check the condition for \(m\) or \(n\) being even:**
   - If \(m\) is even, we can color the board in a checkerboard pattern:
     - Color the first two rows white, the next two rows black, and so on.
     - This ensures that each square has an even number of neighbors of the same color.
   - Similarly, if \(n\) is even, we can use the same checkerboard pattern but applied to columns.

4. **Prove the necessity of \(mn\) being even:**
   - Assume we have a valid coloring for the \(m \times n\) board.
   - Consider the graph where vertices represent black squares and edges represent shared vertices (corners).
   - Each vertex in this graph has an even degree (even number of neighbors of the same color).
   - By the Handshaking Lemma, the sum of the degrees of all vertices in a graph is even.
   - Therefore, the number of vertices (black squares) must be even.
   - The same argument applies to the white squares.
   - Hence, the total number of squares \(mn\) must be even.

5. **Conclusion:**
   - The condition \(2 \mid mn\) (i.e., \(mn\) is even) is both necessary and sufficient for the given coloring condition.

The final answer is \( \boxed{ (m, n) \in \mathbb{Z}^2 } \) such that \(2 \mid mn\).