n = int(input())
s = input()

if n == 1:
    print(0)
elif n == 2:
    if s[0]=="#" and s[1]==".":
        print(1)
else :
    t = s[0]
    
    r = []
    cnt = 1
    for i in range(1, n):
        if t == s[i]:
            cnt += 1
        else :
            r.append(cnt)
            cnt = 1
            t = s[i]
    
    r.append(cnt)
    
    if s[0] == ".":
        r.pop(0)

    if len(r) <= 1:
        print(0)
        
    else :
        ans = 0
        if len(r) % 2 == 0:
            for i in range(0, len(r), 2):
                if r[i] > r[i+1]:
                    ans += r[i+1]
                else :
                    ans += r[i]
        else :
            for i in range(0, len(r)-1, 2):
                if r[i] > r[i+1]:
                    ans += r[i+1]
                else :
                    ans += r[i]    
        print(ans)