#include <bits/stdc++.h>
int main() {
  int m, n;
  while (~scanf("%d %d", &m, &n)) {
    char a[110][110];
    int sum = 0, flag = 0;
    for (int i = 0; i < m; i++) {
      scanf("%s", &a[i]);
    }
    for (int k = 0; k < m; k++) {
      for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
          if (a[k][i] < a[j][i]) {
            flag = 2;
            break;
          } else if (j == m - 1) {
            sum++;
            flag = 1;
            break;
          }
        }
        if (flag == 1) {
          break;
        } else if (flag == 2)
          continue;
      }
    }
    printf("%d\n", sum);
  }
  return 0;
}
