#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, ans = 0;
  cin >> n >> m;
  int a[m];
  char b[n][m];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++) cin >> b[i][j];
  for (int j = 0; j < m; j++) {
    int maxx = 0;
    for (int k = 0; k < n; k++) maxx = max(maxx, ((int)(b[k][j]) - 48));
    a[j] = maxx;
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++)
      if (b[i][j] == a[j] + '0') {
        ans++;
        break;
      }
  }
  cout << ans << endl;
  return 0;
}
