N = int(input())
S = list(input())
b,w = 0,0

if '#' not in S:
    print(0)
elif '.' not in S:
    print(0)
else:
    f = S.index('#')
    Sr = S[::-1]
    e = Sr.index('.')
    for i in range(f,N-e):
        if S[i] == '#':
            b += 1
        else:
            w += 1

    print(min(b,w))