N = int(input())
S = input()

white = []
black = []
tmp_white = 0
tmp_black = 0

for i in range(N):
    if S[i] == ".":
        tmp_white += 1
        if tmp_black > 0:
            black.append(tmp_black)
            tmp_black = 0
    else:
        tmp_black += 1
        if tmp_white > 0:
            white.append(tmp_white)
            tmp_white = 0

if tmp_black > 0:
    black.append(tmp_black)

if tmp_white > 0:
    white.append(tmp_white)

if S[0] == ".":
    white = white[1:]

if S[-1] == "#":
    black = black[:-1]

print(min(sum(white), sum(black)))