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

a=0
b=0
d=0
flag=1

revS = S[::-1]

if S.find("#.") != -1:
    for i in revS:
        if i == "#":
            if flag==-1:
                a+=1


        else:
            b+=1
            flag=-1

    if a>b:
        print(b-d)
    else:
        print(a-d)

else:
    print(0)