n=int(input())
s=input()
cnt=0
if s[0]=='.':
  cnt=cnt
  if s[n-1]=='#':
    cnt=cnt
    for i in range(1,n-1):
      if s[i]=='.':
        cnt+=1
      else:
        cnt-=1
    if cnt=<0:
      print(s.count('.')-1)
    else:
      print(s.count('#')-1)
  else:
    for i in range(1,n):
      if s[i]=='.':
        cnt+=1
      else:
        cnt-=1
    if cnt=<0:
      print(s.count('.')-1)
    else:
      print(s.count('#'))    
else:
  if s[n-1]=='#':
    cnt=cnt
    for i in range(n-1):
      if s[i]=='.':
        cnt+=1
      else:
        cnt-=1
    if cnt=<0:
      print(s.count('.'))
    else:
      print(s.count('#')-1)
  else:
    for i in range(n):
      if s[i]=='.':
        cnt+=1
      else:
        cnt-=1
    if cnt=<0:
      print(s.count('.'))
    else:
      print(s.count('#'))


