#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, ans = 0;
  cin >> n >> m;
  char s[n][m];
  char d[n], max;
  int p[n];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> s[i][j];
    }
    p[i] = 0;
  }
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < n; j++) {
      d[j] = s[j][i];
    }
    sort(d, d + n);
    max = d[n - 1];
    for (int j = 0; j < n; j++) {
      if (s[j][i] == max) {
        p[j]++;
      }
    }
  }
  for (int i = 0; i < n; i++) {
    if (p[i] > 0) ans++;
  }
  cout << ans << endl;
  return 0;
}
