#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, flag, i, j, highi, highj, highest, counter = 0, k;
  cin >> n >> m;
  vector<string> v;
  string a;
  for (i = 0; i < n; i++) {
    cin >> a;
    v.push_back(a);
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      highest = v[i][j];
      for (k = 0; k < n; k++) {
        if (v[k][j] > highest) break;
      }
      if (k == n) {
        counter++;
        break;
      }
    }
  }
  cout << counter;
}
