A reservoir basin is mapped as an R-by-C grid: 0 is a water cell and 1 is a wall (land) cell. A pool is a maximal group of water cells connected through shared edges (up, down, left, or right; diagonal touches do not connect).
A pool is enclosed if none of its cells lie on the outer border of the grid (any pool that reaches an edge of the grid can drain away and does not count). Count how many enclosed pools there are.
Input format
Line 1: two integers R and C.
Next R lines: each contains C space-separated integers, each 0 (water) or 1 (wall).
Output format
A single integer: the number of enclosed pools.
Constraints
- 1 <= R, C <= 200
- Each cell is 0 or 1.