N=int(input())
S=input()
count_W=0
count_B=0
W=0
B=0
tmp=0
L=[[0 for i in range(2)] for j in range(N+1)]
T=[0 for k in range(N+2)]
for i in range(1,N+1):
	if S[i-1]=="#":
		L[i][1]=L[i-1][1]+1
		L[i][0]=L[i-1][0]
	if S[i-1]==".":
		L[i][0]=L[i-1][0]+1
		L[i][1]=L[i-1][1]
for i in range(1,N+2):
	if i==N+1:
		T[i]=L[N][0]+L[N][1]-L[N-1][1]
	else:
		T[i]=L[i][1]-L[i-1][1]+L[i-1][0]

print(min(T[2:]))