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

sharp = list()
dot = list()
count = 0

while '#.' in S:
    S = list(S)
    for i in range(N):
        if S[i] == '#':
            if len(sharp) > 0 and len(dot) > 0:
                if len(sharp) >= len(dot):
                    for j in dot:
                        S[j] = '#'
                        count += 1
                else:
                    for j in sharp:
                        S[j] = '.'
                        count += 1
                
                sharp = list()
                dot = list()
            sharp.append(i)
        elif S[i] == '.' and len(sharp) > 0:
            dot.append(i)
    S = ''.join(S)
print(count)