n = int(input())
stones = input()
b = 0 
w = 0
prev = False
ans = 0
for c in stones:
    if c == '#':
        if prev is True:
            ans += min(b, w)
            b = 0
            w = 0
        b += 1
        prev = False
    else:
        w += 1
        prev = True
ans += min(b, w)
print(ans)