#include <bits/stdc++.h>
const long long MOD = 1e9 + 7;
using namespace std;
void solve() {
  long long n, m;
  cin >> n >> m;
  string a[n];
  long long x[m];
  vector<long long> v(m, INT_MIN);
  for (long long i = 0; i < (n); ++i) {
    cin >> a[i];
  }
  set<long long> s;
  for (long long i = 0; i < (m); ++i) {
    for (long long j = 0; j < (n); ++j) {
      if (a[j][i] - '0' > v[i]) {
        v[i] = a[j][i] - '0';
      }
    }
    for (long long j = 0; j < (n); ++j) {
      if (a[j][i] - '0' == v[i]) {
        s.insert(j);
      }
    }
  }
  cout << s.size();
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  long long t = 1;
  while (t--) {
    solve();
    cout << "\n";
  }
}
