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