#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  string arr[100];
  bool *arr2 = new bool[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    arr2[i] = 0;
  }
  for (int i = 0; i < m; i++) {
    int max = arr[0].at(i);
    for (int j = 0; j < n; j++) {
      if (arr[j].at(i) > max) max = arr[j].at(i);
    }
    for (int j = 0; j < n; j++) {
      if (arr[j].at(i) == max) {
        arr2[j] = 1;
      }
    }
  }
  int c = 0;
  for (int i = 0; i < n; i++)
    if (arr2[i] == 1) c++;
  cout << c;
}
