import sys
input = sys.stdin.readline
N = int(input())
S = input()
B,W = [],[]
key = '#'
i = 0

for s in S:
    if s == '#' and key == '.':
        W.append(i)
        i = 0
        key = '#'
    elif s == '.' and key == '#':
        B.append(i)
        i = 0
        key = '.'
    i += 1
W.append(i) if s == '.' else 0

ans = 0
for b,w in zip(B,W):
    ans += min(b,w)
print(ans)