N,M=map(int,input().split()) M1=[0 for i in range(M)] M2=[[0] for i in range(M)] for i in range(N): R = stdin.read().splitlines() for j in range(M): if R[j]>M1[j]: M1[j]=R[j] M2[j]=[i] elif R[j]==M1[j]: M2[j].append(i) ans=[] for k in range(M): ans+=M2[k] print(len(set(ans)))