# coding:utf-8



def main():

    N = int(eval(input()))

    s = eval(input())

    count_white = 0

    count_black = 0

    count_border = N

    temp = ""

    patern3_white = [0]*N

    patern3_black = [0]*N

    # patern3 = []

    if (not "." in s) or (not "#" in s):

        print((0))

        return



    for i in s:

        if i == ".":

            count_white += 1

        elif i == "#":

            count_black += 1



    for i in range(N-1):

        if i == 0:

            if s[0] == "#":

                patern3_white[0] = 1

                patern3_black[0] = count_white

            else:

                patern3_white[0] = 0

                patern3_black[0] = count_white -1

        else :

            if s[i] == "#":

                patern3_white[i] = patern3_white[i-1] + 1

                patern3_black[i] = patern3_black[i-1]

            else :

                patern3_white[i] = patern3_white[i-1]

                patern3_black[i] = patern3_black[i-1] - 1

        # patern3.append(patern3_white[i] + patern3_black[i])



        if count_border > patern3_white[i] + patern3_black[i] :

            count_border = patern3_white[i] + patern3_black[i]



    # print(patern3_black)

    # print(patern3_white)

    # print(patern3)

    # print()

    # count_border = min(patern3)

    # print(count_white)

    # print(count_black)

    # print(count_border)

    print((min(count_white,count_black,count_border)))



if __name__ == "__main__":

    main()
# coding:utf-8



def main():

    N = int(eval(input()))

    s = eval(input())

    count_white = 0

    count_black = 0

    count_border = N

    # patern_border_white = [0]*N

    # patern_border_black = [0]*N



    if (not "." in s) or (not "#" in s):

        print((0))

        return



    for i in s:

        if i == ".":

            count_white += 1

        elif i == "#":

            count_black += 1



    patern_border_white = 0

    patern_border_black = 0

    temp_border_white = 0

    temp_border_black = 0

    

    for i in range(N-1):

        if i == 0:

            if s[0] == "#":

                # patern_border_white[0] = 1

                # patern_border_black[0] = count_white

                temp_border_white = 1

                temp_border_black = count_white



            else:

                # patern_border_white[0] = 0

                # patern_border_black[0] = count_white -1

                temp_border_white = 0

                temp_border_black = count_white -1



        else :

            if s[i] == "#":

                # patern_border_white[i] = patern_border_white[i-1] + 1

                # patern_border_black[i] = patern_border_black[i-1]

                temp_border_white = patern_border_white + 1

                temp_border_black = patern_border_black

            else :

                # patern_border_white[i] = patern_border_white[i-1]

                # patern_border_black[i] = patern_border_black[i-1] - 1

                temp_border_white = patern_border_white

                temp_border_black = patern_border_black - 1



        if count_border > temp_border_white + temp_border_black :

            count_border = temp_border_white + temp_border_black



        patern_border_white = temp_border_white

        patern_border_black = temp_border_black



    print((min(count_white,count_black,count_border)))



if __name__ == "__main__":

    main()
# coding:utf-8
def main():
    N = int(eval(input()))
    s = eval(input())
    count_white = 0
    count_black = 0
    count_border = N
    temp = ""
    patern3_white = [0] * N
    patern3_black = [0] * N
    # patern3 = []
    if (not "." in s) or (not "#" in s):
        print((0))
        return
    for i in s:
        if i == ".":
            count_white += 1
        elif i == "#":
            count_black += 1
    for i in range(N - 1):
        if i == 0:
            if s[0] == "#":
                patern3_white[0] = 1
                patern3_black[0] = count_white
            else:
                patern3_white[0] = 0
                patern3_black[0] = count_white - 1
        else:
            if s[i] == "#":
                patern3_white[i] = patern3_white[i - 1] + 1
                patern3_black[i] = patern3_black[i - 1]
            else:
                patern3_white[i] = patern3_white[i - 1]
                patern3_black[i] = patern3_black[i - 1] - 1
        # patern3.append(patern3_white[i] + patern3_black[i])
        if count_border > patern3_white[i] + patern3_black[i]:
            count_border = patern3_white[i] + patern3_black[i]
    # print(patern3_black)
    # print(patern3_white)
    # print(patern3)
    # print()
    # count_border = min(patern3)
    # print(count_white)
    # print(count_black)
    # print(count_border)
    print((min(count_white, count_black, count_border)))


if __name__ == "__main__":
    main()

# coding:utf-8
def main():
    N = int(eval(input()))
    s = eval(input())
    count_white = 0
    count_black = 0
    count_border = N
    # patern_border_white = [0]*N
    # patern_border_black = [0]*N
    if (not "." in s) or (not "#" in s):
        print((0))
        return
    for i in s:
        if i == ".":
            count_white += 1
        elif i == "#":
            count_black += 1
    patern_border_white = 0
    patern_border_black = 0
    temp_border_white = 0
    temp_border_black = 0
    for i in range(N - 1):
        if i == 0:
            if s[0] == "#":
                # patern_border_white[0] = 1
                # patern_border_black[0] = count_white
                temp_border_white = 1
                temp_border_black = count_white
            else:
                # patern_border_white[0] = 0
                # patern_border_black[0] = count_white -1
                temp_border_white = 0
                temp_border_black = count_white - 1
        else:
            if s[i] == "#":
                # patern_border_white[i] = patern_border_white[i-1] + 1
                # patern_border_black[i] = patern_border_black[i-1]
                temp_border_white = patern_border_white + 1
                temp_border_black = patern_border_black
            else:
                # patern_border_white[i] = patern_border_white[i-1]
                # patern_border_black[i] = patern_border_black[i-1] - 1
                temp_border_white = patern_border_white
                temp_border_black = patern_border_black - 1
        if count_border > temp_border_white + temp_border_black:
            count_border = temp_border_white + temp_border_black
        patern_border_white = temp_border_white
        patern_border_black = temp_border_black
    print((min(count_white, count_black, count_border)))


if __name__ == "__main__":
    main()

-    temp = "" -    patern3_white = [0] * N -    patern3_black = [0] * N -    # patern3 = [] +    # patern_border_white = [0]*N +    # patern_border_black = [0]*N +    patern_border_white = 0 +    patern_border_black = 0 +    temp_border_white = 0 +    temp_border_black = 0 -                patern3_white[0] = 1 -                patern3_black[0] = count_white +                # patern_border_white[0] = 1 +                # patern_border_black[0] = count_white +                temp_border_white = 1 +                temp_border_black = count_white -                patern3_white[0] = 0 -                patern3_black[0] = count_white - 1 +                # patern_border_white[0] = 0 +                # patern_border_black[0] = count_white -1 +                temp_border_white = 0 +                temp_border_black = count_white - 1 -                patern3_white[i] = patern3_white[i - 1] + 1 -                patern3_black[i] = patern3_black[i - 1] +                # patern_border_white[i] = patern_border_white[i-1] + 1 +                # patern_border_black[i] = patern_border_black[i-1] +                temp_border_white = patern_border_white + 1 +                temp_border_black = patern_border_black -                patern3_white[i] = patern3_white[i - 1] -                patern3_black[i] = patern3_black[i - 1] - 1 -        # patern3.append(patern3_white[i] + patern3_black[i]) -        if count_border > patern3_white[i] + patern3_black[i]: -            count_border = patern3_white[i] + patern3_black[i] -    # print(patern3_black) -    # print(patern3_white) -    # print(patern3) -    # print() -    # count_border = min(patern3) -    # print(count_white) -    # print(count_black) -    # print(count_border) +                # patern_border_white[i] = patern_border_white[i-1] +                # patern_border_black[i] = patern_border_black[i-1] - 1 +                temp_border_white = patern_border_white +                temp_border_black = patern_border_black - 1 +        if count_border > temp_border_white + temp_border_black: +            count_border = temp_border_white + temp_border_black +        patern_border_white = temp_border_white +        patern_border_black = temp_border_black