import sys
n = int(input())
S = input()

i = S.find('#')
if i < 0:
    print(0)
    sys.exit()

a = 0
c = S.count('.')
Min = 200000


for j in range(i, n):
    if S[j:j+1] == '#':
        b = c - (j-a)
        Min = min(Min, a+b)
        a += 1
        
print(Min)