#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  int i, j;
  cin >> n >> m;
  vector<string> v;
  string s;
  int arr[n][m];
  for (i = 0; i < n; i++) {
    cin >> s;
    v.push_back(s);
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      arr[i][j] = v[i][j] - '0';
    }
  }
  vector<int> maxi;
  vector<int> maxv;
  for (j = 0; j < m; j++) {
    int max = arr[0][j];
    int index = 0;
    for (i = 0; i < n; i++) {
      if (arr[i][j] >= max) {
        max = arr[i][j];
      }
    }
    maxv.push_back(max);
  }
  for (j = 0; j < m; j++) {
    for (i = 0; i < n; i++) {
      if (arr[i][j] == maxv[j]) maxi.push_back(i);
    }
  }
  for (i = 0; i < maxi.size(); i++) {
  }
  sort(maxi.begin(), maxi.end());
  maxi.erase(unique(maxi.begin(), maxi.end()), maxi.end());
  for (i = 0; i < maxi.size(); i++) {
  }
  cout << maxi.size();
  return 0;
}
