n=int(input())
s=input()
l=list()
if '#' in s:
  for i in range(n):
    if s[i]=='#':
      l.append(i)
  for i in range(len(l)-1):
    if l[i+1]-l[i]>=2:
      cnt=l[i+1]
  if (cnt-l[0]+1)//2>l.index(cnt)+1:
    print(l.index(cnt)+1)
  else:
    print(cnt-l[0]-l.index(cnt))
else:
  print(0)