# n=int(input())
# s=list(input())
# s2=s[:]
# s2.reverse()
# c=0
# for i in range(len(s)):
#   a=s[i]
#   if a=='#':
#     if i!=len(s)-1 and s[i+1]=='.':
#       s[i+1]='#'
#       c+=1
# c2=0
# for i in range(len(s2)):
#   a=s2[i]
#   if a=='.':
#     if i!=len(s2)-1 and s2[i+1]=='#':
#       s2[i+1]='.'
#       c2+=1
# print(s,s2)
# print(min(c,c2))

n=int(input())
s=list(input())
l=[]
a=s[0]
b=a
c=1
for x in s[1:]+['a']:
  if a==x:
    c+=1
  else:
    a=x
    l.append(c)
    c=1

l1=[]
l2=[]
a1=b1=0
f=0
for x in l:
  if f==0:
    a1+=x
    f=1
    l1.append(a1)
  else:
    b1+=x
    f=0
    l2.append(b1)
# print(l1,l2)
mn=1000000
if b=='.':
  l1=[0]+l1
  l2=[0,0]+l2
  for i in range(len(l1)):
    # print(l1[-1]-l1[i]+l2[i])
    mn=min(l1[-1]-l1[i]+l2[i],mn)
  print(mn)
else:
  l1=[0]+l1
  if len(l1)-1==len(l2):
    l2=[0]+l2
  else:
    l2=[0]+l2
  for i in range(len(l2)):
    # print(l1[-1]-l1[i]+l2[i])
    mn=min(l1[-1]-l1[i]+l2[i],mn)
  print(mn)

# if b=='#':
#   for i in range(len(l)//2):
#     cx+=(min(l[2*i],l[2*i+1]))
# else:
#   l2=l[1:]+[0]
#   for i in range(len(l2)//2):
#     cx+=(min(l2[2*i],l2[2*i+1]))
# print(cx)