#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<vector<int>> data(n, vector<int>(m));
  string s;
  for (int i = 0; i < n; i++) {
    cin >> ws;
    getline(cin, s);
    for (int j = 0; j < s.length(); ++j) data[i][j] = s[j] - '0';
  }
  vector<bool> mark(n, false);
  for (int i = 0; i < m; ++i) {
    int max = data[0][i];
    for (int j = 0; j < n; ++j) {
      if (data[j][i] > max) {
        max = data[j][i];
      }
    }
    for (int j = 0; j < n; ++j) {
      if (data[j][i] == max) mark[j] = true;
    }
  }
  int c = 0;
  for (int i = 0; i < mark.size(); ++i) {
    if (mark[i] == true) c++;
  }
  cout << c << endl;
}
