# coding: utf-8
# Your code here!

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

b = sum([1 for i in s if i=="#"])
w = n-b

ans = 0
f = False

for i in s:
    if i == "#":
        b-=1
        if b<w and not f:
            ans+=1
        else:
            f = True
    else:
        if f:
            ans+=1
        w-=1


print(ans)