//#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; //#define int long long #define ln '\n' #define y0 y3487465 #define y1 y8687969 #define j0 j1347829 #define j1 j234892 #define next asdnext #define prev asdprev #define P(p) cout << (p) << endl; #define S(s) cin << (s); #define reps(i,a,b) for(int (i)=(a); (i)<(b); ++(i)) #define rep(i,n) reps(i,0,n) #define repst(i,a,b) rep(i,s,(n)+1) #define rept(i,n) rep(i,(n)+1) #define reprt(i,a,b) for(int (i)=(a); (i)>=(b); --(i)) #define repr(i,n) reprt(i,n,0) #define all(v) (v).begin(),(v).end() #define rall(v) (v).rbegin(),(v).rend() #define debug(x) cerr << #x << ": " << x << '\n' #define chmax(x,y) x=max(x,y) #define chmin(x,y) x=min(x,y) #define tmax(x,y,z) max(x,max(y,z)) #define tmin(x,y,z) min(x,min(y,z)) #define fastIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0) typedef long double ld; typedef long long ll; typedef pair pii; typedef pair pll; typedef vector vi; typedef vector vl; typedef vector vst; typedef vector vb; typedef vector vld; typedef vector vpii; typedef vector vpll; typedef vector > mat; const int MOD = 1e9 + 7; const int INF = 1e9; const ll INFF = 1e18; const double EPS = 1e-9; const double PI = acos(-1.0); /*********TEMPLATE**********/ int main() { int N, M, t; cin >> N >> M; mat R; rep(i,N) { vi tmp; rep(j,M) { cin >> t; tmp.push_back(t); } R.push_back(tmp); } /* rep(i,N) { rep (j,M) { cout << R[i][j] << ' '; } cout << ln << ln; } */ rep(i,N) { vi s(0); rep(j,M) { vi r(0); rep(k,i+1) { r.push_back(R[k][j]); //cout << r[k] << ' ';/// } int m = *max_element(all(r)); //cout << "m: " << m << ln; rep(k,i+1) { if (r[k]==m) { s.push_back(k); } } } sort(s.begin(), s.end()); s.erase( unique(s.begin(), s.end()), s.end() ); cout << s.size() << ln; } return 0; }