n = int(input())
s = input()

min_num = n
white_num = s.count('.')
black_num = 0

if white_num == n or s.count('#') == n:
    print(0)
else:
    for i in range(n):
        if s[i] == '#':
            black_num += 1
        else:
            white_num -= 1
        if min_num >= black_num + white_num:
            min_num = black_num + white_num
    print(min_num)