N = int(input())
S = list(input())
c = 0
a = 0
cw = [0] * N
cb = [0] * N
tw = 0
tb = 0
for i in range(N):
    if S[i] == '.':
        tw += 1
        cw[i] = tw
        cb[i] = tb
    else:
        tb += 1
        cb[i] = tb
        cw[i] = tw
tw = 0
tb = 0
A = 0
for i in range(N):
    if c == 0 and S[i] == '#':
        if cw[N - 1] - cw[i] >= cb[N - 1] - cb[i] + 1:
            a += 1
        else:
            A = cw[N - 1] - cw[i]
            c = 1
            tb += 1
    elif c == 1 and S[i] == '#':
        tb += 1
    elif c == 1 or c == 2 and S[i] == '.':
        c = 2
        tw += 1
    elif c == 2:
        if tb > tw:
            a += A
            print(a)
            break
        else:
            c = 0
            a += tb
            tw = 0
            tb = 0
print(a + tw)
