N = int(input())
S = list(input())

sharp_num =[]
dot_num = []

search = '#'
count = 0

for c in S:
    if search == '#':
        if c == search:
            count += 1
        else:
            sharp_num.append(count)
            count = 1
            search = '.'
    else:
        if c == search:
            count += 1
        else:
            dot_num.append(count)
            count = 1
            search = '#'
            
if search == '#':
    sharp_num.append(count)
    dot_num.append(0)
else:
    dot_num.append(count)

total = 0
for i in range(len(sharp_num)):
    total += min(sharp_num[i],dot_num[i])

print(total)




