import numpy as np
N = int(input())
S = input()

sa = np.array([1 if i == "#" else 0 for i in S])
num = np.arange(N)
num_w = num[sa==0]
num_b = num[sa==1]
if len(num_w) == 0 or len(num_b) == 0:
    print(0)
    import sys
    sys.exit()
if num_b[-1] == N-1:
    w0 = 0
    w = len(num_w)
    b = np.sum([num_b<num_w[-1]])
else:
    w = np.sum([num_w<num_b[-1]])
    w0 = len(num_w) - w
    b = np.sum([num_b<num_w[num_w<num_b[-1]][-1]])
if w > b:
    print(b+w0)
else:
    print(w+w0)