n = int(input())
s = input() #sys.stdin.readlineは最後が改行

ans1 = s.count('.')
ans2 = s.count('#')

ans = 0
tmp = 0
for i in reversed(range(n)):
    if s[i] == '.':
        tmp+=1
    elif s[i] == '#':
        ans += tmp
        tmp = 0

print(min(ans1,ans2,ans))
