N,M = list(map(int, input().split())) S = [] for _ in range(N): S.append(input()) from collections import defaultdict dict = defaultdict(int) for i in range(N): for j in range(M): if S[i][j]=="o": dict[j]+=1 minc = 10**10 for v in dict.values(): minc = min(minc,v) ans = N-minc+1 print(ans)