Program Tenka2019C

integer n,a,b,c
character(200000) s

read(*,*) n,s

a=0
b=0
c=0

do i=1,n
if (s(i:i)=='#') then
 a=a+1
else
 b=b+1
end if
end do

do i=n,1,-1
 if (s(i:i)=='#') then
  c=c+1
 else
  go to 10
 end if
end do

10 write(*,*) min(a-c,b)

stop
end