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

first_w = 10 ** 6
last_b = 10 ** 6

for i in range(N):
    if S[i] == ".":
        first_w = i + 1
        break

for i in range(N):
    if S[N - 1 - i] == "#":
        last_b = N - i
        break

change_num1 = -1
change_num2 = 0
S = "s" + S
if first_w < 10 ** 6:
    for s in S[:first_w]:
        if s == "#":
            change_num1 += 1
    for s in S[first_w:]:
        if s == ".":
            change_num1 += 1

if last_b < 10 ** 6:
    for s in S[:last_b]:
        if s == "#":
            change_num2 += 1
    for s in S[last_b:]:
        if s == ".":
            change_num2 += 1

print(min(change_num1, change_num2))