#!/usr/bin/env python3
import re

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

first = 0
position = 0
secondposition = 0
count2 = 0
for i in reversed(range(n)):
    if(first == 0 and s[i] == '#'):
        first += 1
        position = i+1
    if(first == 1 and s[i] == '.'):
        secondposition = i+1
        break;
if(position == 0):
    ans1 = 0
elif(secondposition == 0):
    ans1 =min(n-position,position)
else:
    for j in range(secondposition-1):
        if(s[j] == '#'):
            count2 += 1

    count1 = n - position

    ans1 = count1 + count2


first2 = 0
position2 = 0
secondposition2 = 0
count4 = 0
for i in range(n):
    if(first2 == 0 and s[i] == '.'):
        first2 += 1
        position2 = i+1
    if(first2 == 1 and s[i] == '#'):
        secondposition2 = i+1
        break;
if(position2 == 0):
    ans2 = 0
elif(secondposition2 == 0):
    ans2 = min(n-position2,position2)
else:
    for j in range(secondposition2-1,n):
        if(s[j] == '.'):
            count4 += 1

    count3 = position2-1

    ans2 = count3 + count4
print(min(ans1,ans2))