Program Tenka2019C

integer n,a,b
character(200000) s

read(*,*) n,s

a=0
b=0

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

if(s(n:n)=='#') then
 write(*,*) min(a-1,b)
else
 write(*,*) min(a,b)
end if

stop
end