n, m = map(int, input().split()) lines = [] for _ in range(n): lines.append(input()) t = 1 for col in range(m): new_frame = True for row in lines: if row[col] != "_": new_frame = False break if new_frame: t += 1 print(t)