#include <bits/stdc++.h>
using namespace std;
int main() {
  int rows, cols;
  cin >> rows >> cols;
  string x[1000];
  for (int i = 0; i < rows; i++) cin >> x[i];
  int max[1000];
  for (int i = 0; i < 1000; i++) max[i] = 0;
  for (int i = 0; i < cols; i++) {
    for (int j = 0; j < rows; j++) {
      if (max[i] < x[j][i] - '0') {
        max[i] = x[j][i] - '0';
      }
    }
  }
  bool taken[1000];
  for (int i = 0; i < 1000; i++) taken[i] = false;
  for (int i = 0; i < cols; i++) {
    for (int j = 0; j < rows; j++) {
      if (max[i] == x[j][i] - '0') {
        taken[j] = true;
      }
    }
  }
  int count = 0;
  for (int i = 0; i < 1000; i++)
    if (taken[i]) count++;
  cout << count << endl;
  return 0;
}
