let n = stdin.ReadLine() |> int
let x = stdin.ReadLine().Split() |> Array.map int
let max = Array.max x
let min = Array.min x
let rec f i v p = if i=n then v else f (i+1) (v+(x.[i]-p)*(x.[i]-p)) p
[min..max] |> List.map (f 0 0) |> List.min |> stdout.WriteLine