program main
  implicit none
  integer::N,Z,W
  integer,allocatable,dimension(:)::a
  read*,N,Z,W
  allocate(a(N))
  read*,a
  print"(i0)",merge(abs(a(N)-W),max( abs(a(N)-W), abs(a(N-1)-a(N)) ),N==1)
end program main