N = int(input())
S = list(input())
b_start = N
w_goal = -1
for i in range(N):
    if S[i]=='#':
        b_start=i
        break
for i in range(N-1,-1,-1):
    if S[i]=='.':
        w_goal = i
        break
if b_start>w_goal:
    print(0)
else:
    S = S[b_start:w_goal+1]
    left = S[:0].count('#')
    right = S[0:].count('.')
    cou = 10**10
    for i in range(1,len(S)+1):
        if S[i-1]=='#':
            left+=1
        else:
            right-=1
        cou = min(cou,left+right)
    print(cou)