N = int(input())
S = list(input())
w = 0
b = 0
ans = 0
for i in range(N):
    if S[i] == '#':
        if w > 0 and b > 0:
            ans += min(w, b)
            b = 1
        else:
            b += 1
        w = 0
    else:
        w += 1
    if i == N-1:
        ans += min(w, b)
print(ans)
