#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<string> v(n);
  for (string &s : v) cin >> s;
  vector<int> high;
  for (int i = 0; i < m; i++) {
    int mx = -1;
    for (int j = 0; j < n; j++) {
      mx = max(mx, v[j][i] - '0');
    }
    high.push_back(mx);
  }
  int count = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (v[i][j] - '0' >= high[j]) {
        count++;
        break;
      }
    }
  }
  cout << count << endl;
  return 0;
}
