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

a=0
b=0
d=0
dot_c=0
sharp_c=0
revS = S[::-1]

for i in S:
    if i == ".":
        dot_c += 1
    else:
        break

for i in revS:
    if i == "#":
        sharp_c += 1
    else:
        break

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

        else:
            b+=1

    if a>b:
        print(b-dot_c)
    else:
        print(a-sharp_c)

else:
    print(0)