def trans(c): if c == "#": return 1 else: return 0 N = int(input()) S = list(input()) S = list(map(trans, S)) cnt = 0 ans = 0 for i in range(N - 1, -1, -1): if S[i]: ans = max(ans, N - i + cnt) cnt += 1 else: cnt = max(0, cnt - 1) print(ans)