let () = Scanf.scanf "%d\n" @@ fun n ->
  let xys = Array.init n @@ fun _ -> Scanf.scanf "%d %d\n" @@ fun x y -> x, y in
  let rmax = Array.fold_right (fun (x, y) -> max @@ max x y) xys min_int in
  let bmin = Array.fold_right (fun (x, y) -> min @@ min x y) xys max_int in
  let (rmin, bmax) = Array.fold_left (fun (rmin, bmax) (x, y) ->
    if x <= y
    then (min rmin y, max bmax x)
    else (min rmin x, max bmax y)) (max_int, min_int) xys in
  Printf.printf "%d\n" @@ (rmax - rmin) * (bmax - bmin)

