#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, i, j, grade;
  scanf("%d%d", &n, &m);
  bool succ[n];
  memset(succ, false, sizeof(succ));
  getchar();
  string s[n];
  for (i = 0; i < n; i++) cin >> s[i];
  int ans = 0;
  for (j = 0; j < m; j++) {
    grade = -1;
    for (i = 0; i < n; i++) grade = max(grade, s[i][j] - 48);
    for (i = 0; i < n; i++)
      if (s[i][j] - 48 == grade) succ[i] = true;
  }
  for (i = 0; i < n; i++)
    if (succ[i] == true) ans++;
  printf("%d", ans);
  return 0;
}
