from sys import stdin
N = int(stdin.readline().rstrip())
ss = stdin.readline().rstrip()
sum = 0
left = 0
right = 0
for itr in range(0,N):
    if itr == N-1:
        break
    if ss[itr] == '#' and ss[itr+1] == '.':
        left = itr
        right = left + 1
        count_dot = 0
        count_sharp = 0
        while(right < N and ss[right] == '.'):
            count_dot += 1
            right += 1
        while(left >= 0 and ss[left] == '#'):
            count_sharp += 1
            left -= 1
        # print(count_dot, count_sharp)
        sum += min(count_dot, count_sharp)
print(sum)
