#include <bits/stdc++.h>
using namespace std;
int main() {
  map<int, bool> ma;
  char ch[100][100];
  int n, m, answer = 0;
  cin >> n >> m;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; cin >> ch[i][j++])
      ;
  for (int i = 0; i < m; ++i) {
    char Max = NULL;
    for (int j = 0; j < n; Max = max(Max, ch[j++][i]))
      ;
    for (int j = 0; j < n; ++j)
      if (ch[j][i] == Max && !ma[j]) {
        ++answer;
        ma[j] = true;
      }
  }
  cout << answer << endl;
  return 0;
}
