#include <bits/stdc++.h>
using namespace std;
int n, m, b[100], c = 0;
string a[100];
bool f[100];
int main() {
  cin >> n >> m;
  for (int i = 0; i < m; i++) b[i] = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    f[i] = false;
  }
  for (int i = 0; i < m; i++)
    for (int j = 0; j < n; j++) b[i] = max(b[i], a[j][i] - '0');
  for (int i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      if (a[i][j] - '0' >= b[j]) f[i] = true;
  for (int i = 0; i < n; i++)
    if (f[i]) c++;
  cout << c;
  return 0;
}
