#include <bits/stdc++.h>
using namespace std;
int main() {
  int n = 0, m = 0, x;
  cin >> n >> m;
  if (n == 1) {
    cout << "1" << endl;
    return 0;
  }
  int **array = 0;
  set<int> set1;
  array = new int *[n];
  for (int i = 0; i < n; i++) array[i] = new int[m];
  string s;
  for (int i = 0; i < n; i++) {
    cin >> s;
    for (int j = 0; j < m; j++) {
      array[i][j] = stoi(s.substr(j, 1));
    }
  }
  for (int i = 0; i < m; i++) {
    x = array[0][i];
    for (int j = 0; j < n - 1; j++) {
      if (x <= array[j + 1][i]) x = array[j + 1][i];
    }
    for (int j = 0; j < n; j++) {
      if (array[j][i] == x) set1.insert(j);
    }
  }
  cout << set1.size() << endl;
  for (int i = 0; i < n; i++) delete[] array[i];
  delete[] array;
  return 0;
}
