N = int(input())
S = [i for i in input()]

countb = 0
countw = 0
check = -1
ans = []

for i in range(len(S)):
    if(S[i] == "#"):
        check = 1
        countb = countb + 1
    else:
        check = 0
        countw = countw + 1
    if(check == 1 and countw != 0):
        if(countb < countw):
            ans.append(countb)
        else:
            ans.append(countw)
        countb = 0
        countw = 0
    if(i == N-1):
        if(countb < countw):
            ans.append(countb)
        else:
            ans.append(countw)

print(sum(ans))