N = int(input())
S = input()

count = 0
j = 0

for i in range(N):
    if j < N and S[j] == '#':
        j += 1
        b = 1
        w = 0
        while j < N and S[j] =='#':
            b += 1
            j += 1
        while j < N and S[j] =='.':
            w += 1
            j += 1
        count += min(b,w)
    else:
        j += 1

print(count)