#include <bits/stdc++.h>
using namespace std;
long long n, m, ans[110], num[110][110], sum = 0;
string mp[110];
inline long long read() {
  long long x = 0;
  bool f = 0;
  char ch = getchar();
  for (; !isdigit(ch); ch = getchar()) f ^= (ch == '-');
  for (; isdigit(ch); ch = getchar()) x = (x << 3) + (x << 1) + (ch ^ 48);
  return f ? -x : x;
}
int main() {
  n = read(), m = read();
  for (register int i = 1; i <= n; i++) {
    getline(cin, mp[i]);
  }
  for (register int i = 1; i <= n; i++) {
    for (register int j = 0; j < m; j++) {
      if (mp[i][j] - '0' > ans[j]) {
        ans[j] = mp[i][j] - '0';
      }
    }
  }
  for (register int i = 1; i <= n; i++)
    for (register int j = 0; j < m; j++)
      if (mp[i][j] - '0' == ans[j]) {
        sum++;
        break;
      }
  cout << sum << endl;
  return 0;
}
