N = int(input())
S = input()
if len(set(S)) == 1:
    print(0)
    exit()

sum_blacks = [0] * (N + 1)
for i in range(N):
    if S[i] == "#":
        sum_blacks[i+1] = sum_blacks[i] + 1
    else:
        sum_blacks[i+1] = sum_blacks[i]
print(sum_blacks)
ans = float('inf')
for i in range(N+1):
    l_whites = i - sum_blacks[i]
    l_blacks = sum_blacks[i]
    r_blacks = sum_blacks[-1] - l_blacks
    r_whites = N - l_whites - l_blacks - r_blacks
    ans = min(ans, l_blacks + r_whites)
print(ans)
