# -*- coding:utf-8 -*-



def solve():

    N = int(eval(input()))

    S = eval(input())



    kuro_num = 0

    siro_num = 0

    for moji in S:

        if moji == "#":

            kuro_num += 1

        else:

            siro_num += 1



    if siro_num == N:

        print((0))

        exit()



    # ..........############ のパターン

    rest_kuro_num = kuro_num

    rest_siro_num = siro_num

    ans = siro_num

    for i in range(0, len(S)):

        num = rest_siro_num

        if S[i] == "#":

            num += 1 + (kuro_num - rest_kuro_num)

            rest_kuro_num -= 1

        else:

            num -= 1

            num += kuro_num - rest_kuro_num

            rest_siro_num -= 1

        ans = min(ans, num)



    print(ans)



"""

26

...##..##...##.....#..#..#

"""

if __name__ == "__main__":

    solve()
# -*- coding:utf-8 -*-



def solve():

    N = int(eval(input()))

    S = eval(input())



    kuro_num = 0

    siro_num = 0

    for moji in S:

        if moji == "#":

            kuro_num += 1

        else:

            siro_num += 1



    if siro_num == N:

        print((0))

        exit()



    # ..........############ のパターン

    right_kuro_num = kuro_num

    right_siro_num = siro_num

    ans = siro_num

    for moji in S:

        if moji == "#":

            right_kuro_num -= 1

        else:

            right_siro_num -= 1

        num = right_siro_num + (kuro_num - right_kuro_num)

        ans = min(ans, num)



    print(ans)



"""

26

...##..##...##.....#..#..#

"""

if __name__ == "__main__":

    solve()
# -*- coding:utf-8 -*-
def solve():
    N = int(eval(input()))
    S = eval(input())
    kuro_num = 0
    siro_num = 0
    for moji in S:
        if moji == "#":
            kuro_num += 1
        else:
            siro_num += 1
    if siro_num == N:
        print((0))
        exit()
    # ..........############ のパターン
    rest_kuro_num = kuro_num
    rest_siro_num = siro_num
    ans = siro_num
    for i in range(0, len(S)):
        num = rest_siro_num
        if S[i] == "#":
            num += 1 + (kuro_num - rest_kuro_num)
            rest_kuro_num -= 1
        else:
            num -= 1
            num += kuro_num - rest_kuro_num
            rest_siro_num -= 1
        ans = min(ans, num)
    print(ans)


"""
26
...##..##...##.....#..#..#
"""
if __name__ == "__main__":
    solve()

# -*- coding:utf-8 -*-
def solve():
    N = int(eval(input()))
    S = eval(input())
    kuro_num = 0
    siro_num = 0
    for moji in S:
        if moji == "#":
            kuro_num += 1
        else:
            siro_num += 1
    if siro_num == N:
        print((0))
        exit()
    # ..........############ のパターン
    right_kuro_num = kuro_num
    right_siro_num = siro_num
    ans = siro_num
    for moji in S:
        if moji == "#":
            right_kuro_num -= 1
        else:
            right_siro_num -= 1
        num = right_siro_num + (kuro_num - right_kuro_num)
        ans = min(ans, num)
    print(ans)


"""
26
...##..##...##.....#..#..#
"""
if __name__ == "__main__":
    solve()

-    rest_kuro_num = kuro_num -    rest_siro_num = siro_num +    right_kuro_num = kuro_num +    right_siro_num = siro_num -    for i in range(0, len(S)): -        num = rest_siro_num -        if S[i] == "#": -            num += 1 + (kuro_num - rest_kuro_num) -            rest_kuro_num -= 1 +    for moji in S: +        if moji == "#": +            right_kuro_num -= 1 -            num -= 1 -            num += kuro_num - rest_kuro_num -            rest_siro_num -= 1 +            right_siro_num -= 1 +        num = right_siro_num + (kuro_num - right_kuro_num)