N = int(input())
S = list(input())
black =False
w_num = 0
b_num =0
for i in range(N):
    if black:
        if S[i]==".":
            w_num +=1
    
    if S[i]=="#":
        black =True
        b_num +=1
r_black =0
for j in range(N):
    if S[N-j-1] == "#":
        r_black += 1
    elif S[N-j-1] == ".":
        break


ans = min([w_num,b_num-r_black,N-b_num])
print(ans)