Problem Description
Peanut has N employees, and M tasks that he wishes to assign to them. Each employee can only handle one task, and since not everyone is equally competent, not every employee can do every task. Help Peanut figure out what is the maximum number of tasks he can assign to the employees, if he assigns these tasks optimally.
Input
The first line of input will contain two integers, N and M.
The next N lines of input will contain M integers each. The jth integer on the ith line will be 1 if employee i can complete task j, and 0 otherwise.
Output
The output should contain exactly one integer, the maximum number of tasks Peanut can assign to the employees.
Limits
1 ≤ N, M ≤ 1000.
Sample Input
4 4
0 0 1 0
0 1 0 0
0 1 1 0
1 0 0 1
Sample Output
3