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

sum = 0
sb = 0
sw = 0

for i in range(len(s)):
    if s[i] == '.':
        sw += 1
    else:
        sum += min(sb,sw)
        if (sb > sw):
            sb += sw + 1
            sw = 0
        else:
            sw = 0
            sb = 1

sum += min(sb,sw)

print(sum)