n = int(input())
s = list(input())

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