N = int(input())
S = input()
first_black = -1
last_black = N
for i in range(N):
    if S[i] == "#":
        first_black = i
        break
for i in reversed(range(N)):
    if S[i] == "#":
        last_black = i
    else:
        break
if first_black == -1:
    print(0)
else:
    ans = min(S[first_black:].count("."), S[first_black:].count(
        "#"), S[:last_black].count("#"))

    print(ans)
