#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, max = 0, m = 0;
  cin >> a >> b;
  vector<int> ych(a, 0);
  vector<string> vec(a);
  for (int i = 0; i < a; i++) {
    cin >> vec[i];
  }
  for (int i = 0; i < b; i++) {
    for (int f = 0; f < a; f++) {
      if (vec[f][i] - '0' > max) {
        max = vec[f][i] - '0';
      }
    }
    for (int f = 0; f < a; f++) {
      if (vec[f][i] - '0' == max) {
        ych[f] = 1;
      }
    }
    max = 0;
  }
  for (int i = 0; i < a; i++) {
    if (ych[i] == 1) {
      m++;
    }
  }
  cout << m;
  return 0;
}
