N=input()
S=raw_input()

Color=[]
CNT=[]	#Count
cnt=0
prev=""
for i in range(N):
	if i==0:
		if S[i]=="#": Color.append("b")
		else: Color.append("w")
		cnt+=1
	else:
		if prev==S[i]:
			cnt+=1
		else:
			CNT.append(cnt)
			if S[i]=="#": Color.append("b")
			else: Color.append("w")	
			cnt=1	

	prev=S[i]
else:
	CNT.append(cnt)

l=len(Color)

ans=0
for i in range(l-1):
	if Color[i]=="b" and Color[i+1]=="w" :
		if CNT[i]<=CNT[i+1]:
			ans+=CNT[i]
			Color[i]="w"
		else:
			ans+=CNT[i+1]
			Color[i+1]="b"


print ans
	
		