import numpy as np

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

a = np.zeros((N+1, N))

for i in range(N):
    a[i, :i] = 1
a[N] = 1
L = [0] * N
for i in range(N):
    if S[i] == ".":
        # white
        L[i] = 0
    else:
        L[i] = 1
L = np.array(L)
ans = (a - L)**2
ans = ans.sum(axis=1).min()
print(int(ans))