import numpy as np
N = int(input())
S = input()
blacks = np.zeros(N)
whites = np.zeros(N)
b_cnt = 0
w_cnt = 0
for i in range(N):
    if S[i] == '#':
        b_cnt += 1
        blacks[i] = b_cnt
    else:
        blacks[i] = b_cnt
for i in range(N):
    if S[N-1-i] == '.':
        w_cnt += 1
        whites[N-1-i] = w_cnt
    else:
        whites[N-1-i] = w_cnt

changestones = blacks + whites
# print(blacks)
# print(whites)
# print(changestones)
print(min(np.min(changestones),w_cnt,b_cnt))




