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