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

def solve():
    N = int(input())
    S = 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] == "#":
            rest_kuro_num -= 1
            num += 1 + (kuro_num - rest_kuro_num)
        else:
            rest_siro_num -= 1
            num += kuro_num - rest_kuro_num
        ans = min(ans, num)

    print(ans)

if __name__ == "__main__":
    solve()