N=int(input())-1;S=input();f=[];flag=0;l=0;
for i in range(N):
 if S[i] == "#" and i != N:
  if S[i+1] == ".":
   while (1):
    if S[i-l] != "#":
     f.append(abs(l));l=0;break
    l+=1;
   while (1):
    if i+l != N:
     if S[i+l+1] != ".":
      f.append(l);l=0;break
     l+=1
    else:
     f.append(l);l=0;break
   flag += min(f);f=[];
print(flag)
