#include <bits/stdc++.h>
int main() {
  int n, m, x, y;
  scanf("%d %d", &n, &m);
  char a[n][m], max[m];
  int s[n];
  for (int i = 0; i < m; i++) {
    max[i] = '0';
  }
  for (int i = 0; i < n; i++) {
    s[i] = 0;
  }
  for (int i = 0; i < n; i++) {
    scanf("%c", &x);
    for (int j = 0; j < m; j++) {
      scanf("%c", &a[i][j]);
      if (a[i][j] == '\n') scanf("%c", &a[i][j]);
    }
  }
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < n; j++) {
      if (a[j][i] >= max[i]) max[i] = a[j][i];
    }
  }
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < n; j++) {
      if (a[j][i] == max[i]) s[j] = 1;
    }
  }
  int sum = 0;
  for (int i = 0; i < n; i++) {
    sum += s[i];
  }
  printf("%d", sum);
  return 0;
}
