N=int(input())
S = input()
left = -1
for i, s in enumerate(S):
    if s == '#':
        left = i
        break
if S[-1] == '#':
    sharps = S.split('.')
    t=len(sharps[-1])
    t2=len(sharps[-2])
    a=len(S.split('#')[-2])
    print(min(S.count('#')-t, S[left:].count('.'), S.count('#')-t-t2+a))
else:
    sharps = S.split('.')
    t=len(sharps[-2])
    a=len(S.split('#')[-1])
    print(min(S.count('#'), S[left:].count('.'), S.count('#')-t+a))
