n = int(input())
raw = input()
start_idx = 0
count = 0
 
for s in raw:
    if s == '#':
        break
    start_idx = start_idx + 1
 
tmpb = 1
tmpw = 1
flg = '#'
reset = False
for i in range(start_idx, n):
    if reset:
        tmpb = 1
        tmpw = 1
        flg = '#'
        reset = False
    if flg == '#':
        if raw[i] == flg:
            tmpb = tmpb + 1
        else:
            flg = '.'
    else:
        if raw[i] == flg:
            tmpw = tmpw + 1
        else:
            reset = True
            if tmpb >= tmpw:
                count = count + tmpw
            else:
                count = count + tmpb

if raw[-1] = '.' 
    if tmpb >= tmpw:
        count = count + tmpw
    else:
        count = count + tmpb
 
 
print(count)