import re

def C(N, S):
#   S = re.sub("(?<=\.)#+$", "", S)
#   S = re.sub("^\.+(?=#)", "", S)

    n_left_black = []
    sum_left_black = 0
    for c in S:
        if c == "#":
            sum_left_black += 1
        n_left_black.append(sum_left_black)

    n_right_white = []
    sum_right_white = 0
    for c in reversed(S):
        if c == ".":
            sum_right_white += 1
        n_right_white.append(sum_right_white)
    n_right_white.reverse()

#   print(n_left_black)
#   print(n_right_white)

    answer = 0
    for i, c in enumerate(S):
        if n_left_black[i] < n_right_white[i]:
            comp = "."
        elif n_left_black[i] > n_right_white[i]:
            comp = "#"
        else:
            if i < len(S)/2:
                comp = "."
            else:
                comp = "#"
#       print(comp)
        if comp != c:
            answer += 1
    print(answer)
        
#   if len(S) == 0:
#       print("0")
#   else:
#       n_white = S.count(".")
#       n_black = S.count("#")
#       print(min(n_white, n_black))

if __name__ == "__main__":
    N = int(input())
    S = input()
    C(N, S)