#C
N = int(input())
S = str(input())
sign = ('.', '#')
if N == 1:
    print(0)
else:
    c1, c2 = S.count('#'), 0
    ans = c1 + c2
    for i in range(0,N):
        if S[i] == '#':
            c1 -= 1
        else:
            c2 += 1
        tmp = c1 + c2
        ans = min(ans, tmp)
    print(ans)
