#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<bool> s(n);
  vector<vector<int>> v(n);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) {
      char t;
      cin >> t;
      v[i].push_back(t - '0');
    }
  for (int i = 0; i < n; i++) s[i] = 0;
  for (int j = 0; j < m; j++) {
    int max = -1e9;
    for (int i = 0; i < n; i++)
      if (v[i][j] > max) max = v[i][j];
    for (int i = 0; i < n; i++)
      if (max == v[i][j]) s[i] = 1;
  }
  int res = 0;
  for (int i = 0; i < n; i++)
    if (s[i]) res++;
  cout << res;
  return 0;
}
