n = int(input())
s = input()

w_counter_all = 0
for i in range(n):
    if s[i] == '.': # white
        w_counter_all += 1

if s[0] == '.':
    cost1 = 0
else:
    cost1 = 1
cost1_list = [cost1]
for i in range(1, n):
    if s[i] == '#':
        # black
        cost1 += 1
    cost1_list.append(cost1)



if w_counter_all == 0:
    print(0)
else:
    cost_all = []
    for i in range(n):
        cost_all.append(n - i - 1 - cost1_list[-1] + cost1_list[i] * 2)
    print(min(cost_all))
