#include <bits/stdc++.h>
using namespace std;
void Code_Crush() {
  ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
}
int main() {
  Code_Crush();
  int n, m;
  cin >> n >> m;
  vector<string> grades(n);
  set<int> successful;
  for (auto& i : grades) cin >> i;
  for (int i = 0; i < m; i++) {
    char max_grade = '0';
    for (int j = 0; j < n; j++) max_grade = max(max_grade, grades[j][i]);
    for (int j = 0; j < n; j++)
      if (grades[j][i] == max_grade) successful.emplace(j);
  }
  cout << int(successful.size());
  return 0;
}
