n = int(eval(input()))

s = eval(input())



s = s.rstrip('#')

s = s.lstrip('.')



if len(set(s)) <= 1:

    print((0))

    exit(0)



turn_to_black = s.count('.')

current_min = turn_to_black

turn_to_white = 0



for i in range(len(s)):

    if s[i] == '#':

        turn_to_white +=1

    else:

        turn_to_black -=1

    current_min = min(current_min, turn_to_black + turn_to_white)

print(current_min)



n = int(eval(input()))

s = eval(input())



s = s.rstrip('#')

s = s.lstrip('.')



def seek(n, s):

    turn_to_black = s.count('.')

    current_min = turn_to_black

    turn_to_white = 0



    if current_min == 0 or current_min == len(s):

        return(0)

    # seek minimum turns to create "^\.*#*$" 

    for i in range(len(s)):

        if s[i] == '#':

            turn_to_white +=1

        else:

            turn_to_black -=1

        current_min = min(current_min, turn_to_black + turn_to_white)

    return current_min

print((seek(n, s)))

n = int(eval(input()))
s = eval(input())
s = s.rstrip("#")
s = s.lstrip(".")
if len(set(s)) <= 1:
    print((0))
    exit(0)
turn_to_black = s.count(".")
current_min = turn_to_black
turn_to_white = 0
for i in range(len(s)):
    if s[i] == "#":
        turn_to_white += 1
    else:
        turn_to_black -= 1
    current_min = min(current_min, turn_to_black + turn_to_white)
print(current_min)

n = int(eval(input()))
s = eval(input())
s = s.rstrip("#")
s = s.lstrip(".")


def seek(n, s):
    turn_to_black = s.count(".")
    current_min = turn_to_black
    turn_to_white = 0
    if current_min == 0 or current_min == len(s):
        return 0
    # seek minimum turns to create "^\.*#*$"
    for i in range(len(s)):
        if s[i] == "#":
            turn_to_white += 1
        else:
            turn_to_black -= 1
        current_min = min(current_min, turn_to_black + turn_to_white)
    return current_min


print((seek(n, s)))

-if len(set(s)) <= 1: -    print((0)) -    exit(0) -turn_to_black = s.count(".") -current_min = turn_to_black -turn_to_white = 0 -for i in range(len(s)): -    if s[i] == "#": -        turn_to_white += 1 -    else: -        turn_to_black -= 1 -    current_min = min(current_min, turn_to_black + turn_to_white) -print(current_min) + + +def seek(n, s): +    turn_to_black = s.count(".") +    current_min = turn_to_black +    turn_to_white = 0 +    if current_min == 0 or current_min == len(s): +        return 0 +    # seek minimum turns to create "^\.*#*$" +    for i in range(len(s)): +        if s[i] == "#": +            turn_to_white += 1 +        else: +            turn_to_black -= 1 +        current_min = min(current_min, turn_to_black + turn_to_white) +    return current_min + + +print((seek(n, s)))