#include <bits/stdc++.h>
using namespace std;
int high[105];
vector<string> v;
bool stu[105];
int main() {
  int n, m;
  cin >> n >> m;
  string s;
  for (int i = 0; i < n; i++) {
    cin >> s;
    v.push_back(s);
    for (int i = 0; i < s.size(); i++) {
      int x = s[i] - '0';
      high[i] = max(high[i], x);
    }
  }
  for (int i = 0; i < v.size(); i++) {
    for (int j = 0; j < v[i].size(); j++) {
      int x = v[i][j] - '0';
      if (x == high[j]) {
        stu[i] = 1;
      }
    }
  }
  int c = 0;
  for (int i = 0; i < n; i++) {
    if (stu[i]) c++;
  }
  cout << c << endl;
  return 0;
}
