program november_30
  implicit none
  integer :: m(2), d(2)
  read(*,*) m(1), d(1)
  read(*,*) m(2), d(2)
  if (m(1) == m(2)) then
    write(*,'(i0)') 0
  else
    write(*,'(i0)') 1
  end if
end program november_30