#include <bits/stdc++.h>
using namespace std;
int d[101];
int n, m;
vector<string> arr;
void check(int m) {
  vector<int> temp;
  for (int i = 0; i < n; i++) {
    string str = arr[i];
    temp.push_back(str[m] - '0');
  }
  int mx = *max_element(temp.begin(), temp.end());
  for (int i = 0; i < temp.size(); i++) {
    if (temp[i] == mx) {
      d[i] += 1;
    }
  }
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < 101; i++) d[i] = 0;
  for (int i = 0; i < n; i++) {
    string data;
    cin >> data;
    arr.push_back(data);
  }
  for (int i = 0; i < m; i++) {
    check(i);
  }
  int count = 0;
  for (int i = 0; i < n; i++) {
    if (d[i] > 0) count += 1;
  }
  cout << count << endl;
  return 0;
}
