#d=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
#import numpy as np
#import math
#n=int(input())
#li=input().split()
#S=input()
#import fractions
#lis=list(map(int,input().split()))

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

flag=-1
count=0
for i in range(n):
    if s[i]=="#":
        count+=1
        if flag==-1:
            flag=i
btw=count
wtb=n-count-flag
ans=min(btw,wtb)
if count==0 or count==n:
    ans=0

print(ans)
