#include <bits/stdc++.h>
using namespace std;
int main() {
  int p, q;
  cin >> p >> q;
  string s;
  int **b = new int *[p];
  for (long long int i = 0; i < p; i++) b[i] = new int[q];
  for (long long int i = 0; i < p; i++) {
    cin >> s;
    for (long long int j = 0; j < q; j++) {
      b[i][j] = int(s[j]);
    }
  }
  for (long long int j = 0; j < q; j++) {
    int c = b[0][j];
    for (long long int i = 0; i < p; i++) {
      if (b[i][j] > c) {
        c = b[i][j];
      }
    }
    for (long long int i = 0; i < p; i++) {
      if (b[i][j] == c) {
        b[i][j] = 0;
      }
    }
  }
  int e = 0;
  for (long long int i = 0; i < p; i++) {
    for (long long int j = 0; j < q; j++) {
      if (b[i][j] == 0) {
        e += 1;
        break;
      }
    }
  }
  cout << e << "\n";
  return 0;
}
