def main():
    n = int(input())
    s = input()
    black = s.count("#")
    ans = 10**10
    cnt = 0
    for i in range(n):
        if s[i] == "#":
            cnt += 1
        tmp = n - black + 2*cnt - i - 1
        if tmp < ans:
            ans = tmp
    print(ans)


if __name__ == "__main__":
    main()
