A geological scan produces a grid of rows by cols cells. Each cell is either empty (0) or contains a mineral deposit (1). Two deposit cells belong to the same cluster if they are adjacent — including diagonally (up, down, left, right, and all four diagonal directions all count as adjacent).
Count the number of distinct deposit clusters.
Input format
Line 1: two integers rows and cols.
Next rows lines: a string of exactly cols characters, each 0 or 1.
Output format
A single integer: the number of 8-directionally connected clusters of 1 cells.
Constraints
- 1 ≤ rows, cols ≤ 12