N,S = open(0).read().split()
N=int(N)
S=list(S)

def makeGroup():
    group = [] if S[0] == '.' else [0]
    n = 0
    mark = S[0]
    for s in S:
        if s == mark:
            n += 1
        else:
            mark = s
            group.append(n)
            n = 1
    if n > 0:
        group.append(n)
    if mark == '#':
        group.append(0)
    return group

group = makeGroup()
i = 0
j = len(group) - 1
cnt = 0
while i < j:
    wl = group[i]
    bl = group[i+1]
    wr = group[j]
    br = group[j - 1]
    l = bl if wl <= bl else wl
    r = wr if wr <= br else br
    if l < r:
        cnt += l
        i += 2
    else:
        cnt += r
        j -= 2

print(cnt)