N = int(input())
S = input()
B,W = [],[]
key = '.'
ans = 10**9
i = 0

for s in S:
    if s == '#' and key == '.':
        W.append(i)
        i = 0
        key = '#'
    elif s == '.' and key == '#':
        B.append(i)
        i = 0
        key = '.'
    i += 1
W.append(i) if s == '.' else B.append(i)

for i in range(len(S)//2+1):
    ans = min(ans,sum(B[i:])+sum(W[:i+1]))
print(ans)