#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  vector<string> a(n);
  vector<int> s(m);
  set<int> d;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
  }
  for (int i = 0; i < m; ++i) {
    int mx = 0;
    for (int j = 0; j < n; ++j) {
      int temp = (int)(a[j][i] - '0');
      mx = max(temp, mx);
    }
    s[i] = mx;
  }
  for (int i = 0; i < m; ++i) {
    for (int j = 0; j < n; ++j) {
      int temp = (int)(a[j][i] - '0');
      if (s[i] == temp) d.insert(j);
    }
  }
  cout << d.size();
}
