n = int(input()) s = list(input()) ans = -1 for i in range(n-1, -1, -1): if s[i] == "#": ans = max(ans + 2, n - i) print(ans)