There is a chessboard with $m$ columns and $n$ rows. In each blanks, an integer is given. If a rectangle $R$ (in this chessboard) has an integer $h$ satisfying the following two conditions, we call $R$ as a 'shelf'. 
(i) All integers contained in $R$ are bigger than $h$.
(ii) All integers in blanks, which are not contained in $R$ but meet with $R$ at a vertex or a side, are not bigger than $h$.
Assume that all integers are given to make shelves as much as possible. Find the number of shelves.
1. **Define the Problem and Notations:**
   - We have a chessboard with \( m \) columns and \( n \) rows.
   - Each cell contains an integer.
   - A rectangle \( R \) on this chessboard is called a 'shelf' if:
     - All integers in \( R \) are greater than an integer \( h \).
     - All integers in cells adjacent to \( R \) (but not in \( R \)) are less than or equal to \( h \).
   - We aim to find the maximum number of shelves, denoted as \( f(R_0) \), where \( R_0 \) is the entire chessboard.

2. **Upper Bound on the Number of Shelves:**
   - We claim that for any \( n \times m \) chessboard, \( f(R_0) \leq \left\lfloor \frac{(m+1)(n+1)}{2} - 1 \right\rfloor \).
   - To prove this, we use two lemmas.

3. **Lemma 1:**
   - For any two shelves \( X \) and \( Y \) in \( R_0 \), either one is enclosed in the other, or they are disjoint.
   - If they are disjoint, they cannot share a vertex or an edge.

4. **Lemma 2:**
   - Consider shelves \( R_1, R_2, \ldots, R_a \) such that the only shelf enclosing \( R_i \) is \( R_0 \).
   - Extend each \( R_i \) horizontally and vertically by 0.5 units to form \( T_i \).
   - All \( T_i \) are disjoint.

5. **Induction Hypothesis:**
   - We use induction on \( m+n \).
   - Base cases \( m+n = 2, 3, 4 \) can be verified directly.
   - Assume the hypothesis holds for all chessboards with \( k+l < m+n \).

6. **Induction Step:**
   - For each \( R_i \), let \( c_i \) be the number of columns and \( r_i \) be the number of rows.
   - By the induction hypothesis, \( f(R_i) \leq \left\lfloor \frac{(c_i+1)(r_i+1)}{2} - 1 \right\rfloor \).
   - The area of \( T_i \) is \( (c_i+1)(r_i+1) \).
   - Since \( T_i \) are disjoint, \( \sum_{i=1}^{a} (c_i+1)(r_i+1) \leq (m+1)(n+1) \).

7. **Combining Results:**
   - \( f(R_0) = 1 + \sum_{i=1}^{a} f(R_i) \leq 1 + \sum_{i=1}^{a} \left\lfloor \frac{(c_i+1)(r_i+1)}{2} - 1 \right\rfloor \).
   - \( \leq 1 + \left( \sum_{i=1}^{a} \frac{(c_i+1)(r_i+1)}{2} \right) - a \).
   - \( \leq 1 - a + \frac{(m+1)(n+1)}{2} \leq -1 + \frac{(m+1)(n+1)}{2} \).
   - Since \( f(R) \) is an integer, \( f(R_0) \leq \left\lfloor \frac{(m+1)(n+1)}{2} - 1 \right\rfloor \).

8. **Constructive Proof for the Upper Bound:**
   - We show that there exists a chessboard configuration such that \( f(R_0) = \left\lfloor \frac{(m+1)(n+1)}{2} - 1 \right\rfloor \).
   - Use induction on \( m+n \).
   - Base cases \( m+n = 2, 3, 4 \) can be verified directly.
   - Assume the hypothesis holds for all chessboards with \( k+l < m+n \).

9. **Case Analysis:**
   - If \( m \) is odd:
     - Arrange integers such that each column \( j \) (where \( j \) is odd) has \( n \) shelves.
     - Additional shelves are formed by submatrices \( n \times l \) where \( l \) is odd.
     - Total shelves: \( \frac{n(m+1)}{2} + 1 + \frac{m-3}{2} = \left\lfloor \frac{(m+1)(n+1)}{2} - 1 \right\rfloor \).

   - If \( m \) is even:
     - Divide the chessboard into \( n \times (m-2) \) and \( n \times 2 \).
     - Arrange integers such that \( f(A) = \left\lfloor \frac{(m-1)(n+1)}{2} - 1 \right\rfloor \).
     - Total shelves: \( 1 + f(A) + f(B) = \left\lfloor \frac{(m+1)(n+1)}{2} - 1 \right\rfloor \).

10. **Conclusion:**
    - From the above steps, we have shown both the upper bound and the existence of a configuration achieving this bound.

\(\blacksquare\)

The final answer is \( \boxed{ \left\lfloor \frac{(m+1)(n+1)}{2} - 1 \right\rfloor } \)