#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, i, j, k, s = 0;
  cin >> n >> m;
  char a[n][m + 1];
  int b[m];
  for (i = 0; i < m; i++) b[i] = 0;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    for (j = 0; j < m; j++) {
      k = a[i][j] - 48;
      b[j] = max(b[j], k);
    }
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      k = a[i][j] - 48;
      if (k == b[j]) {
        s++;
        break;
      }
    }
  }
  cout << s;
  return 0;
}
