Secret Rooms of the Ternopil Castle#4549

Secret Rooms of the Ternopil Castle

1 second
64 megabytes
Easy

On the shore of the picturesque Ternopil Lake stands a castle. Although it appears grand, it surprisingly contains only a few small rooms. Historians, intrigued by the ancient blueprints of the castle, discovered a map showing numerous rooms, all lacking doors and windows. This led them to wonder: how many rooms does the Ternopil Castle actually have?

Input

The first line provides two natural numbers: (3 \le N \le 1000), representing the length of the map, and (3 \le M \le 1000), representing the width of the map. This is followed by lines, each containing characters. The character "1" denotes a section of the wall, while "0" indicates a part of a room. All outer elements of the map are guaranteed to be "1". Two room elements "0" are considered adjacent and part of the same room if they share a common side.

Output

Output a single number indicating the total number of rooms on the discovered map.

Examples

Example 1

Loading
Loading