#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e7 + 10;
const long long MOD = 1000000007;
int arr[110][110];
int mx[110];
int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  int ms = 0;
  string s[110];
  for (int i = 0; i < n; i++) cin >> s[i];
  for (int i = 0; i < n; i++)
    for (int j = 0; j < k; j++) arr[i][j] = s[i][j] - '0';
  for (int i = 0; i < k; i++) {
    ms = 0;
    for (int j = 0; j < n; j++) {
      ms = max(ms, arr[j][i]);
    }
    mx[i] = ms;
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    int cnt = 0;
    for (int j = 0; j < k; j++) {
      if (arr[i][j] == mx[j]) cnt++;
    }
    if (cnt) ans++;
  }
  cout << ans;
}
