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

if N == 1:
    print('0')
else:
    index = 0
    counter = 0
    while index < N:
        if S[index] == '#':
            offset = 1
            while index + offset < N and S[index + offset] == '#':
                offset += 1

            if index + offset == N:
                break
            else:
                count = 1
                memory = offset
                offset += 1
                while index + offset < N and S[index + offset] == '.':
                    offset += 1
                    if count < memory:
                        count += 1
                counter += count
                index += offset
        else:
            index += 1
    print(str(counter))