N = int(input())
s = list(input())

l = []
used, count = set(s[0]), 1
for i in s[1:]:
    if i in used:
        count += 1
    else:
        t = used.pop()
        l.append((t, count))
        count = 1
        used = set(i)
if count:
    l.append((used.pop(), count))

size = len(l)
ans1, ans2 = 0, 0
if l[0][0] == "#":
    for i in range(1, size, 2):
        ans1 += l[i][1]
    for i in range(0, size, 2):
        ans2 += l[i][1]
else:
    for i in range(1, size, 2):
        ans1 += l[i][1]
    for i in range(2, size, 2):
        ans2 += l[i][1]

ans = min(ans1, ans2)
print(ans)