#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m;
  cin >> n >> m;
  string s;
  vector<int> t(0);
  vector<int> stu(n, 0);
  vector<vector<int> > v(m, t);
  for (int i = 0; i < n; ++i) {
    cin >> s;
    for (int j = 0; j < s.length(); ++j) {
      v[j].push_back(stoi(to_string(s[j])));
    }
  }
  for (int i = 0; i < m; ++i) {
    int ma = *max_element(v[i].begin(), v[i].end());
    for (int j = 0; j < v[i].size(); ++j) {
      if (v[i][j] == ma) {
        stu[j] = 1;
      }
    }
  }
  cout << accumulate(stu.begin(), stu.end(), 0) << endl;
  return 0;
}
