#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int m;
  while (cin >> n >> m) {
    string s[n];
    int successful = n;
    for (int i = 0; i < n; i++) {
      cin >> s[i];
    }
    for (int i = 0; i < n; i++) {
      int subjects = m;
      for (int j = 0; j < m; j++) {
        for (int k = 0; k < n; k++) {
          if (s[i][j] < s[k][j]) {
            subjects--;
            break;
          }
        }
      }
      if (!subjects) successful--;
    }
    cout << successful << endl;
  }
  return 0;
}
