n = int(input())
s = input()
cum_sum = 0
black = s.count("#")
ans = n

for i, c in enumerate(s):
    if c == "#":
        cum_sum += 1
    ans = min(ans, cum_sum + n - i - 1 - (black - cum_sum))
print(ans)