#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, i, k, j, c;
  while (scanf("%d%d", &n, &m) != EOF) {
    c = 0;
    char a[990][101], x;
    for (i = 0; i < n; i++) scanf("%s", a[i]);
    for (i = 0; i < n; i++) {
      for (k = 0; k < m; k++) {
        x = a[i][k];
        for (j = 0; j < n; j++) {
          if (x >= a[j][k])
            continue;
          else
            break;
        }
        if (j == n) {
          c = c + 1;
          break;
        }
      }
    }
    printf("%d\n", c);
  }
  return 0;
}
