import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline

sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    N = int(readline())
    S = readline().decode('utf-8').strip()
    idx = S.find('.')
    if idx == -1 or idx == N-1:
        print(0)
    else:
        count = S[idx:].count('.')
        change = min(count, N-idx-count)
        not_change = 0
        for s in S[::-1]:
            if s=='#':
                not_change += 1
            else:
                change -= not_change
                break
        print(change)


if __name__ == '__main__':
    main()
