N = int(input())
S = list(map(lambda x: 1 if x=="#" else 0,input()))

'''
"....####",".......","#########"のいずれかになればよい
累積和を左から見ていけば良い
'''
from itertools import accumulate
S = list(accumulate(S))

fills = min(N,S[-1],N-S[-1])

ans = fills

for i in range(N-1):
    _left = S[i]
    _right = N-i-(S[-1]-S[i])
    ans = min(ans,_left+_right)

print(ans)