Handball

Given each player's goal counts across M matches, count how many players scored at least once in every match.

Easy1ArrayImplementationInterviewNo attempts yetTime limit2sMemory limit512 MB

Problem

A sports club is unhappy with its football results and decides to invest in its handball team. The coaching staff wants to judge players by their consistency, so they ask how many players scored in every single match.

A player counts as scoring in every match when the goal count is at least 1 in all MM matches. One match with 0 goals removes that player from the count.

The record set is large, so the counting has to be done by a program. Read the per-match goal record of each player and count how many players scored in every match.

Input

The first line contains two integers NN and MM, the number of players and the number of matches (1N1001 \le N \le 100, 1M1001 \le M \le 100).

Each of the next NN lines describes one player. The ii-th of these lines contains MM integers X1,X2,,XMX_1, X_2, \dots, X_M, where XjX_j is the number of goals the ii-th player scored in the jj-th match (0Xj1000 \le X_j \le 100).

Output

Print one line with a single integer, the number of players who scored in every match.