import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;
 
public class Main {
  public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    int N = scanner.nextInt();
    List<Integer> xList = new ArrayList<>();
    for(int i = 0;i < N;i++){
      xList.add(scanner.nextInt());
    }
    int maxv = 0;
    for(int v : xList){
      if(v > maxv)maxv = v;
    }
    List<Integer> sumList = new ArrayList<>();
      for(int k = 0;k < maxv + 10;k++){
      int sum = 0;
      for(int x : xList){
        sum = sum + (int)Math.pow((x - k),2);
      }
        sumList.add(sum);
    }
    int miniSum = sumList.get(0);
    for(int sum : sumList){
     if(sum < miniSum)miniSum = sum;
    }
    System.out.println(miniSum);
  }
} import java.util.Scanner; Scanner java.util import java.util.List; List java.util import java.util.ArrayList; ArrayList java.util public class Main {
  public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    int N = scanner.nextInt();
    List<Integer> xList = new ArrayList<>();
    for(int i = 0;i < N;i++){
      xList.add(scanner.nextInt());
    }
    int maxv = 0;
    for(int v : xList){
      if(v > maxv)maxv = v;
    }
    List<Integer> sumList = new ArrayList<>();
      for(int k = 0;k < maxv + 10;k++){
      int sum = 0;
      for(int x : xList){
        sum = sum + (int)Math.pow((x - k),2);
      }
        sumList.add(sum);
    }
    int miniSum = sumList.get(0);
    for(int sum : sumList){
     if(sum < miniSum)miniSum = sum;
    }
    System.out.println(miniSum);
  }
} Main public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    int N = scanner.nextInt();
    List<Integer> xList = new ArrayList<>();
    for(int i = 0;i < N;i++){
      xList.add(scanner.nextInt());
    }
    int maxv = 0;
    for(int v : xList){
      if(v > maxv)maxv = v;
    }
    List<Integer> sumList = new ArrayList<>();
      for(int k = 0;k < maxv + 10;k++){
      int sum = 0;
      for(int x : xList){
        sum = sum + (int)Math.pow((x - k),2);
      }
        sumList.add(sum);
    }
    int miniSum = sumList.get(0);
    for(int sum : sumList){
     if(sum < miniSum)miniSum = sum;
    }
    System.out.println(miniSum);
  } main {
    Scanner scanner = new Scanner(System.in);
    int N = scanner.nextInt();
    List<Integer> xList = new ArrayList<>();
    for(int i = 0;i < N;i++){
      xList.add(scanner.nextInt());
    }
    int maxv = 0;
    for(int v : xList){
      if(v > maxv)maxv = v;
    }
    List<Integer> sumList = new ArrayList<>();
      for(int k = 0;k < maxv + 10;k++){
      int sum = 0;
      for(int x : xList){
        sum = sum + (int)Math.pow((x - k),2);
      }
        sumList.add(sum);
    }
    int miniSum = sumList.get(0);
    for(int sum : sumList){
     if(sum < miniSum)miniSum = sum;
    }
    System.out.println(miniSum);
  } Scanner scanner = new Scanner(System.in); scanner new Scanner(System.in) int N = scanner.nextInt(); N scanner.nextInt() scanner.nextInt scanner List<Integer> xList = new ArrayList<>(); xList new ArrayList<>() for(int i = 0;i < N;i++){
      xList.add(scanner.nextInt());
    } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
      xList.add(scanner.nextInt());
    } {
      xList.add(scanner.nextInt());
    } xList.add(scanner.nextInt()) xList.add xList scanner.nextInt() scanner.nextInt scanner int maxv = 0; maxv 0 for(int v : xList){
      if(v > maxv)maxv = v;
    } int v xList {
      if(v > maxv)maxv = v;
    } {
      if(v > maxv)maxv = v;
    } if(v > maxv)maxv = v; v > maxv v maxv maxv = v maxv v List<Integer> sumList = new ArrayList<>(); sumList new ArrayList<>() for(int k = 0;k < maxv + 10;k++){
      int sum = 0;
      for(int x : xList){
        sum = sum + (int)Math.pow((x - k),2);
      }
        sumList.add(sum);
    } int k = 0; int k = 0; k 0 k < maxv + 10 k maxv + 10 maxv 10 k++ k++ k {
      int sum = 0;
      for(int x : xList){
        sum = sum + (int)Math.pow((x - k),2);
      }
        sumList.add(sum);
    } {
      int sum = 0;
      for(int x : xList){
        sum = sum + (int)Math.pow((x - k),2);
      }
        sumList.add(sum);
    } int sum = 0; sum 0 for(int x : xList){
        sum = sum + (int)Math.pow((x - k),2);
      } int x xList {
        sum = sum + (int)Math.pow((x - k),2);
      } {
        sum = sum + (int)Math.pow((x - k),2);
      } sum = sum + (int)Math.pow((x - k),2) sum sum + (int)Math.pow((x - k),2) sum (int)Math.pow((x - k),2) Math.pow Math (x - k) x k 2 sumList.add(sum) sumList.add sumList sum int miniSum = sumList.get(0); miniSum sumList.get(0) sumList.get sumList 0 for(int sum : sumList){
     if(sum < miniSum)miniSum = sum;
    } int sum sumList {
     if(sum < miniSum)miniSum = sum;
    } {
     if(sum < miniSum)miniSum = sum;
    } if(sum < miniSum)miniSum = sum; sum < miniSum sum miniSum miniSum = sum miniSum sum System.out.println(miniSum) System.out.println System.out System System.out miniSum String[] args args public class Main {
  public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    int N = scanner.nextInt();
    List<Integer> xList = new ArrayList<>();
    for(int i = 0;i < N;i++){
      xList.add(scanner.nextInt());
    }
    int maxv = 0;
    for(int v : xList){
      if(v > maxv)maxv = v;
    }
    List<Integer> sumList = new ArrayList<>();
      for(int k = 0;k < maxv + 10;k++){
      int sum = 0;
      for(int x : xList){
        sum = sum + (int)Math.pow((x - k),2);
      }
        sumList.add(sum);
    }
    int miniSum = sumList.get(0);
    for(int sum : sumList){
     if(sum < miniSum)miniSum = sum;
    }
    System.out.println(miniSum);
  }
} public class Main {
  public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    int N = scanner.nextInt();
    List<Integer> xList = new ArrayList<>();
    for(int i = 0;i < N;i++){
      xList.add(scanner.nextInt());
    }
    int maxv = 0;
    for(int v : xList){
      if(v > maxv)maxv = v;
    }
    List<Integer> sumList = new ArrayList<>();
      for(int k = 0;k < maxv + 10;k++){
      int sum = 0;
      for(int x : xList){
        sum = sum + (int)Math.pow((x - k),2);
      }
        sumList.add(sum);
    }
    int miniSum = sumList.get(0);
    for(int sum : sumList){
     if(sum < miniSum)miniSum = sum;
    }
    System.out.println(miniSum);
  }
} Main
import java.util.Scanner;
import java.util.List;
import java.util.ArrayList;
 
public class Main {
  public static void main(String[] args){
    Scanner scanner = new Scanner(System.in);
    int N = scanner.nextInt();
    List<Integer> xList = new ArrayList<>();
    for(int i = 0;i < N;i++){
      xList.add(scanner.nextInt());
    }
    int maxv = 0;
    for(int v : xList){
      if(v > maxv)maxv = v;
    }
    List<Integer> sumList = new ArrayList<>();
      for(int k = 0;k < maxv + 10;k++){
      int sum = 0;
      for(int x : xList){
        sum = sum + (int)Math.pow((x - k),2);
      }
        sumList.add(sum);
    }
    int miniSum = sumList.get(0);
    for(int sum : sumList){
     if(sum < miniSum)miniSum = sum;
    }
    System.out.println(miniSum);
  }
}