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)))

ans_b = 0
ans_w = 0
for i in range(len(S_rep) - 1):
    if S_rep[i] + S_rep[i + 1] == "#.":
        ans_w += cnt[i]
        ans_b += cnt[i + 1]
print(min(ans_b, ans_w))