import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.Arrays; import java.util.StringTokenizer; public class ProblemA { static Scanner sc = new Scanner(System.in); static PrintWriter pw = new PrintWriter(System.out); public static void main(String[] args) throws IOException { int n = sc.nextInt(); Integer a[] = new Integer[n] ; for(int i = 0 ; i< n ;i ++) a[i] =sc.nextInt() ; Arrays.sort(a); long ans = 0 ; for(int i = 0 ;i