#include <bits/stdc++.h>
using namespace std;
int n, m, ans;
char v[111][111];
char best[111];
int main() {
  int n = 0, m = 0, r = 0;
  cin >> n >> m;
  char v[111][111], mm[111];
  for (int i = 0; i < n; i++) {
    cin >> v[i];
    for (int j = 0; j < m; j++) mm[j] = max(mm[j], v[i][j]);
  }
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      if (v[i][j] == mm[j]) {
        r++;
        break;
      }
  cout << r << endl;
  return 0;
}
