n = int(input())
s = list(input())

black = s.count('#')
if black == 0 or black == n:
    print(0)
else:
    for i in range(n):
        if s[i]=='#':
            bloc = i
            break
    
    ans = min(black, n-black-bloc)
    print(ans)
