N = int(input())

S = input()

count1 = 0
count2 = 0
ans = 0
for i in range(N):
    s = S[i]
    if s == '#':
        if i != 0 and S[i-1] == '.':
            if count1 > 0:
                ans += min(count1, count2)
            count2 = 0
            count1 = 0
        count1 += 1
    elif s == '.':
        count2 += 1
    
    if i == N-1 and s == '.':
        ans += min(count1, count2)

print(ans)
