N = int(input())
S = input()

def run(N, S):
    num_black= S.count('#')
                       
    if num_black == 0:
        return 0
    elif num_black == N:
        return 0

    end_sharp = 0
    for i in reversed(S):
        if i == '.':
            break
        end_sharp += 1

    startpos = 0
    for i in S:
        if i == '#':
            break
        startpos+=1
    
    nums = N - startpos - end_sharp
    if nums > num_black * 2:
        return num_black - end_sharp
    else:
        return nums - num_black + end_sharp
 
print(run(N, S))