#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, answerN = 1, ans[10000];
  cin >> n >> m;
  string s[100];
  int k = 0;
  for (int i = 0; i < n; i++) cin >> s[i];
  for (int j = 0; j < m; j++) {
    int max = 0;
    for (int i = 0; i < n; i++) {
      if (s[i][j] - '0' > max) {
        max = s[i][j] - '0';
      }
    }
    for (int i = 0; i < n; i++)
      if (max == s[i][j] - '0') {
        ans[k] = i;
        k++;
      }
  }
  for (int i = 0; i < k; i++) {
    for (int j = 0; j <= i; j++) {
      if (ans[i] > ans[j]) {
        int temp = ans[i];
        ans[i] = ans[j];
        ans[j] = temp;
      }
    }
  }
  for (int i = 0; i < k - 1; i++)
    if (ans[i] != ans[i + 1]) answerN++;
  cout << answerN;
  return 0;
}
