#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
int n, m;
int a[120][120];
int have[120];
char s[120];
int main() {
  while (scanf("%d%d", &n, &m) != EOF) {
    memset(have, 0, sizeof(have));
    for (int i = 0; i < n; i++) {
      scanf("%s", s);
      for (int j = 0; j < m; j++) {
        a[i][j] = s[j] - '0';
      }
    }
    int num = 0;
    for (int j = 0; j < m; j++) {
      for (int i = 0; i < n; i++) {
        int ok = 1;
        if (!have[i]) {
          for (int k = 0; k < n; k++) {
            if (a[i][j] < a[k][j]) {
              ok = 0;
              break;
            }
          }
          if (ok) {
            have[i] = 1;
            num++;
          }
        }
      }
    }
    cout << num << endl;
  }
  return 0;
}
