#include <bits/stdc++.h>
using namespace std;
int main() {
  char ch, studenti[120][120];
  int max[120] = {};
  char s[120];
  int i, j;
  int n, m;
  scanf("%d %d", &n, &m);
  gets(s);
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      ch = getchar();
      studenti[i][j] = ch;
    }
    gets(s);
  }
  for (i = 0; i < m; i++) {
    max[i] = 0;
    for (j = 0; j < n; j++)
      if ((studenti[j][i] - 48) > max[i]) max[i] = studenti[j][i] - 48;
  }
  int sol = 0;
  for (i = 0; i < n; i++)
    for (j = 0; j < m; j++)
      if (studenti[i][j] - 48 == max[j]) {
        sol++;
        break;
      }
  printf("%d\n", sol);
  return 0;
}
