import sys
sys.setrecursionlimit(10000000)
def input():
    return sys.stdin.readline()[:-1]
from bisect import *
from collections import *
from heapq import *
from fractions import Fraction

n = int(input())
S = input()
ans = 0
l = 0
while l < n and S[l] == '.':
    l += 1
m = r = l
for r in range(l, n-1):
    if S[r:r+2] == '#.':
        m = r
    if S[r:r+2] == '.#':
        ans += min(r-m, m-l+1)
        l = r+1
if S[-1] == '.':
    ans += min(r-m+1, m-l+1)
print(ans)
