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

stones = []

color = None
cnt = 0
for i in range(N):
    if color is None:
        color = S[i]
        cnt = 1
    elif color == S[i]:
        cnt += 1
    else:
        stones.append([color, cnt])
        color = S[i]
        cnt = 1
    if i == N-1:
        stones.append([S[i], cnt])

# print(stones)
ans = 0
for i in range(len(stones)-1):
    if stones[i][0] == '#' and stones[i+1][0] == '.':
        ans += min(stones[i][1], stones[i+1][1])

print(ans)