n = int(input())
s = input()
ans = 0
pre = '.'
b = 0
w = 0
for c in s:
    if c=='.':
        w += 1
    elif c=='#' and pre=='#':
        b += 1
    else:
        ans += min(b, w)
        b = 1
        w = 0
    pre = c
if pre=='.':
    ans += min(b, w)
print(ans)