N = int(input())
S = list(input())

ans1 = 0
for i in range(N):
    if S[i] == '#':
        ans1 = S[i:].count('.')
        break

ans2 = 0
S2 = S[::-1]
for i in range(N):
    if S2[i] == '.':
        ans2 = S2[i:].count('#')
        break

ans3 = 0
for i in range(N-1):
    if S[i] == '#':
        if S[i+1] == '.':
            ans3 += 1

print(min(ans1, ans2, ans3))