import numpy

n = int(input())
char = input()

char_list = numpy.array(list(char),dtype=str)

write = sum(char_list == ".")
black = sum(char_list == "#")
back_black = 0
for i in reversed(char_list):
    if i == "#": 
        back_black += 1
    else:
        break

if char_list[-1] == "#":
    if write <= black - back_black:
        print(write)
    else:
        print(black -back_black)
else:
    if write <= black:
        print(write)
    else:
        print(black)
