#include <bits/stdc++.h>
using namespace std;
void base() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
}
int n, k, ans = 0, arr[105][105];
bool vis[105];
int main() {
  cin >> n >> k;
  string str;
  for (int i = 0; i < n; i++) {
    cin >> str;
    for (int j = (int)0; j < (int)str.size(); j++) {
      int num = str[j] - '0';
      arr[i][j] = num;
    }
  }
  memset(vis, false, sizeof vis);
  for (int i = (int)0; i < (int)k; i++) {
    int largest = 0, idxx, idy;
    for (int j = (int)0; j < (int)n; j++) {
      if (largest < arr[j][i]) {
        largest = arr[j][i];
      }
    }
    for (int j = (int)0; j < (int)n; j++) {
      if (arr[j][i] == largest) vis[j] = true;
    }
  }
  for (int i = (int)0; i < (int)n; i++) {
    if (vis[i]) ans++;
  }
  cout << ans << endl;
  return 0;
}
