program sample
	implicit none
	integer(8) :: n, a, b, s, t

	read(*,*) n, a, b

	if ( mod((b-a),2) == 0 ) then
		write(*,*) (b-a)/2
	end if

	s = min(a-1,n-b)
	t = s + 1 + (b-a-1)/2
	write(*,*) t
	stop
end program sample