N = int(eval(input()))

S = eval(input())



white = [0] * (N + 1)

for i in range(N):

    if S[i] == ".":

        white[i + 1] = white[i] + 1

    else:

        white[i + 1] = white[i]



ans = N

for i in range(N + 1):

    tmp = (i - white[i]) + (white[-1] - white[i])

    if tmp < ans:

        ans = tmp



print(ans)

import sys



sys.setrecursionlimit(10 ** 6)

INF = float("inf")

MOD = 10 ** 9 + 7





def input():

    return sys.stdin.readline().strip()





def main():

    N = int(eval(input()))

    S = eval(input())

    B = S.count("#")

    W = S.count(".")



    # 左からi文字目までの白の数

    n_white = []

    if S[0] == ".":

        n_white.append(1)

    else:

        n_white.append(0)

    for i in range(1, N):

        if S[i] == ".":

            n_white.append(n_white[-1] + 1)

        else:

            n_white.append(n_white[-1])



    # ....##### の並びにする.境目に関して全探索

    ans = min(B, W)

    for i in range(N):

        # 白に変える数

        cnt = i + 1 - n_white[i]



        # 黒に変える数

        cnt += n_white[-1] - n_white[i]



        if cnt < ans:

            ans = cnt



    print(ans)





if __name__ == "__main__":

    main()

N = int(eval(input()))
S = eval(input())
white = [0] * (N + 1)
for i in range(N):
    if S[i] == ".":
        white[i + 1] = white[i] + 1
    else:
        white[i + 1] = white[i]
ans = N
for i in range(N + 1):
    tmp = (i - white[i]) + (white[-1] - white[i])
    if tmp < ans:
        ans = tmp
print(ans)

import sys

sys.setrecursionlimit(10**6)
INF = float("inf")
MOD = 10**9 + 7


def input():
    return sys.stdin.readline().strip()


def main():
    N = int(eval(input()))
    S = eval(input())
    B = S.count("#")
    W = S.count(".")
    # 左からi文字目までの白の数
    n_white = []
    if S[0] == ".":
        n_white.append(1)
    else:
        n_white.append(0)
    for i in range(1, N):
        if S[i] == ".":
            n_white.append(n_white[-1] + 1)
        else:
            n_white.append(n_white[-1])
    # ....##### の並びにする.境目に関して全探索
    ans = min(B, W)
    for i in range(N):
        # 白に変える数
        cnt = i + 1 - n_white[i]
        # 黒に変える数
        cnt += n_white[-1] - n_white[i]
        if cnt < ans:
            ans = cnt
    print(ans)


if __name__ == "__main__":
    main()

-N = int(eval(input())) -S = eval(input()) -white = [0] * (N + 1) -for i in range(N): -    if S[i] == ".": -        white[i + 1] = white[i] + 1 +import sys + +sys.setrecursionlimit(10**6) +INF = float("inf") +MOD = 10**9 + 7 + + +def input(): +    return sys.stdin.readline().strip() + + +def main(): +    N = int(eval(input())) +    S = eval(input()) +    B = S.count("#") +    W = S.count(".") +    # 左からi文字目までの白の数 +    n_white = [] +    if S[0] == ".": +        n_white.append(1) -        white[i + 1] = white[i] -ans = N -for i in range(N + 1): -    tmp = (i - white[i]) + (white[-1] - white[i]) -    if tmp < ans: -        ans = tmp -print(ans) +        n_white.append(0) +    for i in range(1, N): +        if S[i] == ".": +            n_white.append(n_white[-1] + 1) +        else: +            n_white.append(n_white[-1]) +    # ....##### の並びにする.境目に関して全探索 +    ans = min(B, W) +    for i in range(N): +        # 白に変える数 +        cnt = i + 1 - n_white[i] +        # 黒に変える数 +        cnt += n_white[-1] - n_white[i] +        if cnt < ans: +            ans = cnt +    print(ans) + + +if __name__ == "__main__": +    main()