#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<string> stud(n);
  string max = "";
  for (int i = 0; i < m; i++) {
    max += '0';
  }
  for (int i = 0; i < n; i++) {
    cin >> stud[i];
    for (int j = 0; j < m; j++) {
      if (stud[i][j] > max[j]) max[j] = stud[i][j];
    }
  }
  int sol = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (stud[i][j] == max[j]) {
        sol++;
        break;
      }
    }
  }
  cout << sol << endl;
}
