#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int grd[n][m], st = 0, marks[m];
  bool he[n];
  for (int i = 0; i < n; i++) {
    he[i] = false;
    char u;
    for (int j = 0; j < m; j++) {
      cin >> u;
      grd[i][j] = u - 48;
      if (i == 0)
        marks[j] = grd[i][j];
      else if (marks[j] <= grd[i][j])
        marks[j] = grd[i][j];
    }
  }
  for (int j = 0; j < m; j++) {
    for (int i = 0; i < n; i++) {
      if (grd[i][j] == marks[j] && !he[i]) {
        he[i] = true;
        st++;
      }
    }
  }
  cout << st << endl;
}
