#include <bits/stdc++.h>
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, m;
  cin >> n >> m;
  char a[n][m];
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < m; j++) cin >> a[i][j];
  }
  vector<char> v;
  for (long long j = 0; j < m; j++) {
    char c = '0';
    for (long long i = 0; i < n; i++) {
      if (a[i][j] > c) c = a[i][j];
    }
    v.push_back(c);
  }
  long long count = 0;
  for (long long i = 0; i < n; i++) {
    bool okay = false;
    for (long long j = 0; j < m; j++) {
      if (a[i][j] == v[j]) okay = true;
    }
    if (okay) ++count;
  }
  cout << count;
}
