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_b) == 0 or len(num_w) == 0:
    print(0)
    import sys
    sys.exit()
kb = 0
kw = 0
if num_b[-1] == N-1:
    num_b2 = num_b[num_b < num_w[-1]]
    kb = 1
if num_w[0] == 0:
    num_w2 = num_w[num_w > num_b[0]]
    kw = 1
if kb == 1:
    num_b = num_b2
if kw == 1:
    num_w = num_w2
if len(num_b) > len(num_w):
    print(len(num_w))
else:
    print(len(num_b))