#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<string> marks(n);
  for (size_t i = 0; i < n; i++) cin >> marks[i];
  vector<bool> success(n, false);
  for (size_t subject = 0; subject < m; subject++) {
    char best = '0';
    for (size_t student = 0; student < n; student++) {
      if (marks[student][subject] > best) best = marks[student][subject];
    }
    for (size_t student = 0; student < n; student++) {
      if (marks[student][subject] == best) success[student] = true;
    }
  }
  cout << count(success.begin(), success.end(), true);
  return 0;
}
