#include <bits/stdc++.h>
using namespace std;
string s[1010];
int a[1010][1001];
int mxtp[101010];
int t[101010];
int ans;
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; ++i) {
    cin >> s[i];
    for (int j = 0; j < m; ++j) {
      a[i + 1][j + 1] = s[i][j] - '0';
    }
  }
  for (int i = 1; n >= i; i++) {
    for (int j = 1; m >= j; j++) {
      mxtp[j] = max(mxtp[j], a[i][j]);
    }
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= m; ++j) {
      if (mxtp[j] == a[i][j]) {
        ans++;
        break;
      }
    }
  }
  cout << ans;
  return 0;
}
