import sys
from itertools import groupby
N = int(sys.stdin.readline().rstrip())
S = list(sys.stdin.readline().rstrip())

S_rep = ""
cnt = []
for k, v in groupby(S):
    S_rep += k
    cnt.append(len(list(v)))
# print(S_rep)
# print(cnt)
ans = 0
for i in range(len(S_rep) - 1):
    if S_rep[i] + S_rep[i + 1] == "#.":
        if cnt[i] <= cnt[i + 1]:
            ans += cnt[i]
        else:
            if i + 2 < len(S_rep):
                cnt[i + 2] += cnt[i + 1]
            ans += cnt[i + 1]
print(ans)