import sys

def main():
    N = int(input())
    S = input()
    ans = 0
    for i in range(N-1):
        if S[i:i+2]=='#.':
            j = 1
            while i-j>=0 and S[i-j]=='#':
                j += 1
            k = 1
            while i+1+k<N and S[i+1+k]=='.':
                k += 1
            if j <= k:
                ans += j
                temp = ''
                for jj in range(j):
                    temp += '.'
                S = S[:i-j+1] + temp + S[i+1:]
            else:
                ans += k
                temp = ''
                for kk in range(k):
                    temp += '#'
                S = S[:i+1] + temp + S[i+1+k:]
    print(ans)

if __name__ == '__main__':
    main()
