from itertools import chain from sys import stdin, stdout input = lambda: stdin.readline().rstrip() write = stdout.write def main(): N, M = map(int, input().split()) R = [tuple(map(int, input().split())) for _ in [0] * N] winner = [[] for _ in [0] * M] point = [0] * M for i, n in enumerate(R): for j in range(M): if n[j] > point[j]: point[j] = n[j] winner[j] = [i] elif n[j] == point[j]: winner[j].append(i) ans = len(set(chain.from_iterable(winner))) print(ans) main()