from collections import Counter
N = int(input())
S = list(input())
ans = Counter(S)
ans = min(ans["#"], ans["."])
kuro = 0
total = 0
for i in range(N):
    kuro += S[i] == "#"
    if S[i] == ".":
        total += kuro
        kuro = 0
print(min(ans, total))
