#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  char s[n + 2][m + 2];
  int a[102] = {0};
  int i, j, count = 0;
  for (i = 0; i < n; i++) cin >> s[i];
  for (j = 0; j < m; j++) {
    int x = 0;
    for (i = 0; i < n; i++) {
      if (s[i][j] > x) x = s[i][j];
    }
    for (i = 0; i < n; i++) {
      if (s[i][j] == x && a[i] == 0) {
        a[i] = 1;
        count++;
      }
    }
  }
  cout << count;
}
