#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int mas[100][100];
  char str[101];
  for (int i = 0; i < n; i++) {
    cin >> str;
    for (int j = 0; j < m; j++) {
      mas[i][j] = str[j] - 48;
    }
  }
  int count = 0;
  bool res[100];
  for (int j = 0; j < m; j++) {
    int max = mas[0][j];
    int num = 0;
    for (int i = 0; i < n; i++) {
      if (mas[i][j] > max) {
        max = mas[i][j];
        num = j;
      }
    }
    for (int i = 0; i < n; i++) {
      if (mas[i][j] == max) {
        res[i] = 1;
      }
    }
  }
  for (int i = 0; i < n; i++)
    if (res[i] == 1) ++count;
  cout << count;
}
