#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  string str, ma;
  char a[2] = {};
  vector<string> vec;
  vector<int> v;
  vector<char> ch(m, 0);
  char max = '1';
  for (int i = 0; i < n; i++) {
    cin >> str;
    vec.push_back(str);
    for (int j = 0; j < m; j++) {
      if (str[j] >= ch[j]) {
        ch[j] = str[j];
      }
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (vec[i][j] == ch[j]) {
        v.push_back(1);
        break;
      }
    }
  }
  int cnt = 0;
  for (int i = 0; i < v.size(); i++) {
    if (v[i] > 0) {
      cnt++;
    }
  }
  cout << cnt;
  return 0;
}
