import sys
sys.setrecursionlimit(10**9)

def mi(): return map(int,input().split())
def ii(): return int(input())
def isp(): return input().split()
def deb(text): print("-------\n{}\n-------".format(text))

INF=10**20
def main():
    N=ii()
    S=list(input())

    flag = False

    ans = 0
    for i in range(N):
        s = S[i]
        if s == "#":
            flag = True
        if s == ".":
            if flag:
                j = 1
                while i+j < N and S[i+j] != "#":
                    j += 1
                
                k = 1
                while i-1-k >= 0 and S[i-1-k]!= ".":
                    k += 1
                
                if j<k:
                    ans += j
                else:
                    ans += k

            flag = False

    print(ans)

    



if __name__ == "__main__":
    main()