#include <bits/stdc++.h>
using namespace std;
int main() {
  set<int> s;
  int n, m;
  cin >> n >> m;
  int max;
  string def;
  int ar[n][m];
  for (int i = 0; i < n; i++) {
    cin >> def;
    for (int j = 0; j < m; j++) {
      ar[i][j] = def[j];
    }
  }
  for (int i = 0; i < m; i++) {
    max = ar[0][i];
    for (int j = 0; j < n; j++) {
      if (max <= ar[j][i]) max = ar[j][i];
    }
    for (int j = 0; j < n; j++) {
      if (ar[j][i] == max) s.insert(j);
    }
  }
  int ans = s.size();
  cout << ans;
}
