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

w_cnt = 0
w_list = []
b_cnt = 0
b_list = []
for i in range(N):
    if S[i] == '#':
        w_cnt += 1
        w_list.append(w_cnt)
    else:
        w_list.append(w_cnt)

    if S[N-1-i] == '.':
        b_cnt += 1
        b_list.append(b_cnt)
    else:
        b_list.append(b_cnt)
    


ans = N
for i in range(N):
    wa = w_list[i] + b_list[N-2-i]
    if ans > wa:
        ans = wa


if b_list[N-1] == 0 or w_list[N-1] == 0:
    print(0)
else:
    print(ans)
