def main():
    import sys

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

    n = int(input())
    s = input()
    cnt = [0]*(n)
    for i in range(n):
        cnt[i] = cnt[i-1]
        if s[i] == '#':
            cnt[i] += 1
    
    m = cnt[-1]
    ans = 10**9
    for i in range(n):
        tmp = cnt[i] + (n-i-1)-(m-cnt[i])
        ans = min(tmp, ans)
    print(ans)


        
        
if __name__ == '__main__':
    main()