#include <bits/stdc++.h> using namespace std; int main() { int n,m; cin>>n>>m; vector<string> s(n); for(int i=0;i<n;i++) cin>>s[i]; map<string,int> hash; for(int i=0;i<m;i++){ string t; for(int j=0;j<n;j++){ t+=s[j][i]; } hash[t]++; } int ans=0; for(auto [x,y]:hash){ ans=max(ans,y); } cout<<ans<<endl; return 0; }