import sys input = sys.stdin.readline N,M=map(int,input().split()) S=[input().strip() for _ in range(N)] cnt=[0]*M for s in S: for i in range(M): if s[i]=='o': cnt[i]+=1 print(N-min(cnt)+1)