let n = Scanf.scanf "%d" (fun x -> x)
let a = Array.init n (fun _ -> Scanf.scanf " %d" (fun x -> x))
let calc c = a
  |> Array.map (fun v -> (v - c) * (v - c))
  |> Array.fold_left (+) 0
let () = Array.init 210 (fun v -> calc (v-105))
  |> Array.fold_left min 10101010101010
  |> Printf.printf "%d\n"