P2919 [USACO08NOV] Guarding the Farm S

Description

The farm has many hills upon which Farmer John would like to place guards to ensure the safety of his valuable milk-cows. He wonders how many guards he will need if he wishes to put one on top of each hill. He has a map supplied as a matrix of integers; the matrix has N (1 < N

Input Format

\* Line 1: Two space-separated integers: N and M \* Lines 2..N+1: Line i+1 describes row i of the matrix with M space-separated integers: H\_ij

Output Format

\* Line 1: A single integer that specifies the number of hilltops

Explanation/Hint

There are three peaks: The one with height 4 on the left top, one of the points with height 2 at the bottom part, and one of the points with height 1 on the right top corner.