let () =
  let a = Scanf.scanf "%d" (fun n -> Array.init n (fun _ -> Scanf.scanf " %d" (fun x -> x))) in
  let x, y = Array.fold_left min 1001 a, Array.fold_left max 0 a in
  Printf.printf "%d\n" (y-x)
