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

def ranlength(A):
    num = list(A)
    count = 1
    table = []
    for i in range(len(num)):
        try:
            if num[i] == num[i+1]:
               count = count + 1
            else:
                table.append(count)
                count = 1
        except:
            table.append(count)
    return(table)

r=ranlength(s)

if s[0]=='.':
    r.pop(0)
if s[-1]=='#':
    r.pop()

cnt=0
for i in range(len(r)//2):
    cnt+=min(r[2*i],r[2*i+1])

print(cnt)