Byteburg, the capital of Byteotia, is a scenic city set in a valley ringed by mountains. After days of heavy rain the whole city is under water, and King Byteasar has asked his advisors to drain it. The plan is to bring in a number of pumps, place them on the flooded ground, and pump Byteburg dry. Your job is to find the smallest number of pumps that is enough to drain the entire city.
You are given a map of the area as an m×n grid of unit squares. For each square the map records its ground height above sea level and whether the square belongs to Byteburg. The whole area is flooded. Because it is surrounded by much taller mountains, no water can flow off the map. Squares that do not belong to Byteburg do not need to be drained.
A pump can be placed on any square of the map. It keeps running until its own square is completely dry. By the principle of communicating vessels, draining one square also lowers the water in (or fully empties) every square from which water can flow down into it. Water can move only between two squares that share a side (more precisely, squares whose footprints on the horizontal plane share a side, since the squares may sit at different heights), and water only ever flows downhill.
Write a program that reads the map from standard input, computes the minimum number of pumps needed to drain all of Byteburg, and writes that number to standard output.
The first line contains two integers m and n separated by a single space (1≤m,n≤1000).
Each of the next m lines describes one row of the grid. The (i+1)-th line contains n integers xi,1,xi,2,…,xi,n separated by single spaces (−1000≤xi,j≤1000, xi,j=0). The value xi,j describes the j-th square of the i-th row: its ground height above sea level is ∣xi,j∣. If xi,j>0 the square belongs to Byteburg, and if xi,j<0 it lies outside the city. Byteburg need not be connected: the city may consist of several separate pieces.
Print a single integer: the minimum number of pumps needed to drain all of Byteburg.

The picture shows the area of Byteburg together with one valid placement of two pumps.