#include "bits/stdc++.h" #define REP(i,n,N) for(ll i=(n); i<(N); i++) #define RREP(i,n,N) for(ll i=(N-1); i>=n; i--) #define CK(n,a,b) ((a)<=(n)&&(n)<(b)) #define ALL(v) (v).begin(),(v).end() #define p(s) cout<<(s)<> typedef long long int ll; using namespace std; const ll inf=1e18; ll N,M; ll R[100010][12]; int main(){ while(cin>>N>>M){ ll mx[12]; set kouho[12]; REP(i,0,11) mx[i]=0; REP(i,0,N){ REP(j,0,M){ cin>>R[i][j]; } } REP(i,0,N){ set s; REP(j,0,M){ if(R[i][j]>mx[j]){ mx[j] = R[i][j]; kouho[j].clear(); kouho[j].insert(i); }else if(R[i][j]==mx[j]){ kouho[j].insert(i); } for (auto itr = kouho[j].begin(); itr != kouho[j].end(); ++itr) { s.insert(*itr); } } p(s.size()); } } return 0; }