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
for r in range(l+1, n):
    if S[r-1:r+1] == '.#':
        c = S[l:r].count('.')
        ans += min(c, r-l-c)
        l = r
if S[-1] == '.':
    c = S[l:n].count('.')
    ans += min(c, n-l-c)
print(ans)
