#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, s = 0;
  cin >> n >> m;
  vector<vector<int> > mk(n, vector<int>(m));
  vector<int> mx(m, 0);
  for (int i = 0; i < n; ++i) {
    string s;
    cin >> s;
    for (int j = 0; j < m; ++j) {
      mk[i][j] = s[j] - '0';
      mx[j] = max(mx[j], mk[i][j]);
    }
  }
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      if (mk[i][j] == mx[j]) {
        s++;
        break;
      }
    }
  }
  cout << s << endl;
}
