n = int(input())
s = input()

one = []
zero = []
cnt_one = 0
cnt_zero = 0

if s[0] == "#":
    zero.append(0)

for i in s:
    if i == "#":
        cnt_one += + 1
        if cnt_zero != 0:
            zero.append(cnt_zero)
            cnt_zero = 0
    else:
        cnt_zero += 1
        if cnt_one != 0:
            one.append(cnt_one)
            cnt_one = 0

if cnt_one != 0:
    one.append(cnt_one)
else:
    zero.append(cnt_zero)

if s[-1] == "#":
    zero.append(0)

print(min(sum(one[:i]) + sum(zero[i+1:]) for i in range(len(one)+1)))