P1506 Save the oibh Headquarters

Background

The oibh headquarters was suddenly flooded. Your rescue is needed now...

Description

oibh was engulfed by a sudden flood. Fortunately, the oibh headquarters has built walls at some important places, denoted by `*`. A region that is enclosed by walls on all four sides cannot be reached by the flood. Inside the oibh headquarters, there are many important regions, each represented on the map by a single `0`. Given the wall construction map of oibh, determine how many important regions are not flooded.

Input Format

The first line contains two positive integers $x, y$. The next $x$ lines each contain $y$ characters, consisting of `*` and `0`, representing the construction map of the oibh headquarters.

Output Format

Output the number of `0` characters in the oibh headquarters that are not flooded.

Explanation/Hint

For $100\%$ of the testdata, $1 \le x, y \le 500$. Translated by ChatGPT 5