#include <bits/stdc++.h>
using namespace std;
int n, m;
char mp[111][111];
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < m; ++j) cin >> mp[i][j];
  int ans = 0;
  for (int i = 0; i < n; ++i) {
    bool f = 1;
    for (int j = 0; f && j < m; ++j) {
      bool flag = 1;
      for (int k = 0; flag && k < n; ++k)
        if (mp[k][j] > mp[i][j]) flag = 0;
      if (flag) f = 0;
    }
    if (!f) ans++;
  }
  cout << ans << ('\n');
}
