import java.util.*;
 
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    List<Integer> list = new ArrayList<>();
    int n = sc.nextInt();
    while(sc.hasNext()){
    	list.add(sc.nextInt());
    }
    
    int sum = 100000000;
    int challengeSum;
    for(int i = 0; i<101; i++){
     challengeSum = 0;
      for(int j=0; j<n; j++){
        challengeSum = challengeSum + (list.get(j) - i) * (list.get(j) - i);
      }
      if(sum>challengeSum){
        sum = challengeSum;
      }
    }
 
    System.out.println(sum);
  }
} import java.util.*; util.* java public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    List<Integer> list = new ArrayList<>();
    int n = sc.nextInt();
    while(sc.hasNext()){
    	list.add(sc.nextInt());
    }
    
    int sum = 100000000;
    int challengeSum;
    for(int i = 0; i<101; i++){
     challengeSum = 0;
      for(int j=0; j<n; j++){
        challengeSum = challengeSum + (list.get(j) - i) * (list.get(j) - i);
      }
      if(sum>challengeSum){
        sum = challengeSum;
      }
    }
 
    System.out.println(sum);
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    List<Integer> list = new ArrayList<>();
    int n = sc.nextInt();
    while(sc.hasNext()){
    	list.add(sc.nextInt());
    }
    
    int sum = 100000000;
    int challengeSum;
    for(int i = 0; i<101; i++){
     challengeSum = 0;
      for(int j=0; j<n; j++){
        challengeSum = challengeSum + (list.get(j) - i) * (list.get(j) - i);
      }
      if(sum>challengeSum){
        sum = challengeSum;
      }
    }
 
    System.out.println(sum);
  } main {
    Scanner sc = new Scanner(System.in);
    List<Integer> list = new ArrayList<>();
    int n = sc.nextInt();
    while(sc.hasNext()){
    	list.add(sc.nextInt());
    }
    
    int sum = 100000000;
    int challengeSum;
    for(int i = 0; i<101; i++){
     challengeSum = 0;
      for(int j=0; j<n; j++){
        challengeSum = challengeSum + (list.get(j) - i) * (list.get(j) - i);
      }
      if(sum>challengeSum){
        sum = challengeSum;
      }
    }
 
    System.out.println(sum);
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) List<Integer> list = new ArrayList<>(); list new ArrayList<>() int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc while(sc.hasNext()){
    	list.add(sc.nextInt());
    } sc.hasNext() sc.hasNext sc {
    	list.add(sc.nextInt());
    } list.add(sc.nextInt()) list.add list sc.nextInt() sc.nextInt sc int sum = 100000000; sum 100000000 int challengeSum; challengeSum for(int i = 0; i<101; i++){
     challengeSum = 0;
      for(int j=0; j<n; j++){
        challengeSum = challengeSum + (list.get(j) - i) * (list.get(j) - i);
      }
      if(sum>challengeSum){
        sum = challengeSum;
      }
    } int i = 0; int i = 0; i 0 i<101 i 101 i++ i++ i {
     challengeSum = 0;
      for(int j=0; j<n; j++){
        challengeSum = challengeSum + (list.get(j) - i) * (list.get(j) - i);
      }
      if(sum>challengeSum){
        sum = challengeSum;
      }
    } {
     challengeSum = 0;
      for(int j=0; j<n; j++){
        challengeSum = challengeSum + (list.get(j) - i) * (list.get(j) - i);
      }
      if(sum>challengeSum){
        sum = challengeSum;
      }
    } challengeSum = 0 challengeSum 0 for(int j=0; j<n; j++){
        challengeSum = challengeSum + (list.get(j) - i) * (list.get(j) - i);
      } int j=0; int j=0; j 0 j<n j n j++ j++ j {
        challengeSum = challengeSum + (list.get(j) - i) * (list.get(j) - i);
      } {
        challengeSum = challengeSum + (list.get(j) - i) * (list.get(j) - i);
      } challengeSum = challengeSum + (list.get(j) - i) * (list.get(j) - i) challengeSum challengeSum + (list.get(j) - i) * (list.get(j) - i) challengeSum (list.get(j) - i) * (list.get(j) - i) (list.get(j) - i) list.get(j) list.get list j i (list.get(j) - i) list.get(j) list.get list j i if(sum>challengeSum){
        sum = challengeSum;
      } sum>challengeSum sum challengeSum {
        sum = challengeSum;
      } sum = challengeSum sum challengeSum System.out.println(sum) System.out.println System.out System System.out sum String[] args args public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    List<Integer> list = new ArrayList<>();
    int n = sc.nextInt();
    while(sc.hasNext()){
    	list.add(sc.nextInt());
    }
    
    int sum = 100000000;
    int challengeSum;
    for(int i = 0; i<101; i++){
     challengeSum = 0;
      for(int j=0; j<n; j++){
        challengeSum = challengeSum + (list.get(j) - i) * (list.get(j) - i);
      }
      if(sum>challengeSum){
        sum = challengeSum;
      }
    }
 
    System.out.println(sum);
  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    List<Integer> list = new ArrayList<>();
    int n = sc.nextInt();
    while(sc.hasNext()){
    	list.add(sc.nextInt());
    }
    
    int sum = 100000000;
    int challengeSum;
    for(int i = 0; i<101; i++){
     challengeSum = 0;
      for(int j=0; j<n; j++){
        challengeSum = challengeSum + (list.get(j) - i) * (list.get(j) - i);
      }
      if(sum>challengeSum){
        sum = challengeSum;
      }
    }
 
    System.out.println(sum);
  }
} Main
import java.util.*;
 
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    List<Integer> list = new ArrayList<>();
    int n = sc.nextInt();
    while(sc.hasNext()){
    	list.add(sc.nextInt());
    }
    
    int sum = 100000000;
    int challengeSum;
    for(int i = 0; i<101; i++){
     challengeSum = 0;
      for(int j=0; j<n; j++){
        challengeSum = challengeSum + (list.get(j) - i) * (list.get(j) - i);
      }
      if(sum>challengeSum){
        sum = challengeSum;
      }
    }
 
    System.out.println(sum);
  }
}