#include <bits/stdc++.h>
using namespace std;
int dr[4] = {1, -1, 0, 0};
int dc[4] = {0, 0, 1, -1};
map<int, bool> taken;
char a[100][100];
int main() {
  int n, m, c = 0;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      cin >> a[i][j];
    }
  }
  for (int i = 0; i < n; ++i) {
    bool yes = false;
    for (int j = 0; j < m; ++j) {
      bool yes2 = true;
      for (int k = 0; k < n; ++k)
        if (a[k][j] > a[i][j]) yes2 = false;
      if (yes2) yes = true;
    }
    if (yes) c++;
  }
  cout << c;
}
