N = int(input())
S = input()
white = 0
black = 0
ans = 0

for s in S:
    if s == '#' and white == 0:
        black += 1
    elif s == '.' and black > 0:
        white += 1
    elif s == '#' and white > 0:
        ans += min(black,white)
        black = 1
        white = 0
else:
    ans += min(black,white)

print(ans)