#include <bits/stdc++.h>
template <typename T, typename U>
static inline void amin(T &first, U second) {
  if (second < first) first = second;
}
template <typename T, typename U>
static inline void amax(T &first, U second) {
  if (first < second) first = second;
}
using namespace std;
void solve() {
  int n, m, i, j, k, cnt = 0;
  cin >> n >> m;
  char c[n][m];
  for (i = 0; i < n; i++)
    for (j = 0; j < m; j++) cin >> c[i][j];
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      char ck = c[i][j];
      for (k = 0; k < n; k++) amax(ck, c[k][j]);
      if (ck == c[i][j]) {
        cnt++;
        break;
      }
    }
  }
  cout << cnt;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
