open Printf
open Scanf

let id x = x

let rec seq s t f =
  if s > t then []
  else
    let x = f s in
    x :: seq (s + 1) t f

let solve n =
  let ar = Array.init n (fun _ -> scanf "%d " id) in
  let power p = Array.fold_left (fun s x -> (p - x) * (p - x) + s) 0 ar in
  List.fold_left (fun m x -> min m @@ power x) 10000000 @@ seq 1 100 id

let () =
  scanf "%d " solve |> printf "%d\n"
