n, m = map(int, input().split()) A = [list(input()) for i in range(n)] A = list(zip(*A)) mn = m for a in A: mn = min(mn, sum(map(lambda x: x == "o", a))) print(n - mn + 1)