Saddle points#5282

Saddle points

2 seconds
128 megabytes
Very easy

The matrix is given. It contains rows and columns. The saddle point of the matrix is an element that is minimum in its row and maximum in its column.

Find the number of saddle points in a given matrix.

Input

The first line contains two integers and m\:(1 \le n, m \le 750). Then given rows with numbers in each. The -th number of the -th line equals A_{ij}. All A_{ij} do not exceed by absolute value.

Output

Print the number of saddle points.

Examples

Example 1

Loading
Loading

Example 2

Loading
Loading