import numpy as np

N = int(input())
S = input()
L = [0] * N
for i in range(N):
    if S[i] == "#":
        # white
        L[i] = 1
    else:
        L[i] = 0
L = np.array(L, dtype=np.int8)
a = np.zeros((N+1, N), dtype=np.int8)
for i in range(N):
    a[i, :i] = 1
a[N] = 1

ans = (a - L)**2
ans = ans.sum(axis=1).min()
print(ans)