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

cnt = 0
cnt1 = 0
cnt2 = 0
if N == 1:
    print("0")
    exit()
else:
    a=[0,0]
    for i in range(N):
        if S[i] == "#":
            a[0] += 1
        else:
            a[1] += 1
    if a[0] >= a[1]:
        for i in range(N-1):
            x = S[i]
            y = S[i+1]
            if x == "#" and y == ".":
                cnt += 1
                if cnt2 == 0:
                    S = S.replace(".","#",cnt1+1)
                else:
                    S = S.replace(".","#",1)
            if x == ".":
                cnt1 += 1
    else:
        for i in range(N-1):
            x = S[i]
            y = S[i+1]
            if x == "#" and y == ".":
                cnt += 1
                if cnt2 == 0:
                    S = S.replace("#",".",cnt1+1)
                else:
                    S = S.replace("#",".",1)
            if x == "#":
                cnt1 += 1

print(cnt)
