def C(N, S):

    cand = "#" * N

    n_diff_chars = sum(a!=b for a, b in zip(cand, S))

    min_n_diff_chars = n_diff_chars

    for c in S:

        if c == ".":

            n_diff_chars -= 1

        else:

            n_diff_chars += 1

        min_n_diff_chars = min(min_n_diff_chars, n_diff_chars)

    print(min_n_diff_chars)





if __name__ == "__main__":

    N = int(eval(input()))

    S = eval(input())

    C(N, S)
def C(N, S):

    n_diff_chars = S.count(".")

    cand_list = [n_diff_chars]

    for c in S:

        if c == ".":

            n_diff_chars -= 1

        else:

            n_diff_chars += 1

        cand_list.append(n_diff_chars)

    print((min(cand_list)))





if __name__ == "__main__":

    N = int(eval(input()))

    S = eval(input())

    C(N, S)
def C(N, S):
    cand = "#" * N
    n_diff_chars = sum(a != b for a, b in zip(cand, S))
    min_n_diff_chars = n_diff_chars
    for c in S:
        if c == ".":
            n_diff_chars -= 1
        else:
            n_diff_chars += 1
        min_n_diff_chars = min(min_n_diff_chars, n_diff_chars)
    print(min_n_diff_chars)


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

def C(N, S):
    n_diff_chars = S.count(".")
    cand_list = [n_diff_chars]
    for c in S:
        if c == ".":
            n_diff_chars -= 1
        else:
            n_diff_chars += 1
        cand_list.append(n_diff_chars)
    print((min(cand_list)))


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

-    cand = "#" * N -    n_diff_chars = sum(a != b for a, b in zip(cand, S)) -    min_n_diff_chars = n_diff_chars +    n_diff_chars = S.count(".") +    cand_list = [n_diff_chars] -        min_n_diff_chars = min(min_n_diff_chars, n_diff_chars) -    print(min_n_diff_chars) +        cand_list.append(n_diff_chars) +    print((min(cand_list)))