#include <bits/stdc++.h>
using namespace std;
long long n[100000];
long long n1[1000][1000], n2[100000], n3[1000000];
bool bo[1400][1400], bo1[100000];
char ch[1500][1500], ch1[10000], tz;
int main() {
  int a, a1 = 0, a2 = 0, b = 0, c, d = 1, d1 = 2e9, ans = 0, k = 0;
  cin >> a >> b;
  string s[a];
  for (int i = 0; i < a; i++) {
    cin >> s[i];
  }
  for (int i = 0; i < b; i++) {
    c = s[0][i] - 48;
    for (int j = 0; j < a; j++) {
      c = max(c, s[j][i] - 48);
    }
    for (int j = 0; j < a; j++) {
      if (s[j][i] - 48 == c) {
        n2[j]++;
      }
    }
  }
  for (int i = 0; i < 101; i++) {
    if (n2[i] > 0) {
      ans++;
    }
  }
  cout << ans;
}
