SIRO = '.'
KURO = '#'
N = int(input())
S = input()
sLst = []
cnt = 1
if S[0] != '#':
    sLst.append(0)

for i in range(0, N - 1):
    if S[i] == S[i + 1]:
       cnt += 1
    else:
        sLst.append(cnt)
        cnt = 1
    if i == N - 2:
        sLst.append(cnt)
kCnt = 0
sCnt = 0
for i in range(0, len(sLst), 2):
    if len(sLst) >= i + 2:
        kCnt += sLst[i]
        sCnt += sLst[i + 1]
ans = min(kCnt, sCnt)
print(ans)
