Lunar New Year is approaching, and Bob is struggling with his homework – a number division problem.

There are n positive integers a_1, a_2, …, a_n on Bob's homework paper, where n is always an even number. Bob is asked to divide those numbers into groups, where each group must contain at least 2 numbers. Suppose the numbers are divided into m groups, and the sum of the numbers in the j-th group is s_j. Bob's aim is to minimize the sum of the square of s_j, that is $$$∑_{j = 1}^{m} s_j^2.$$$

Bob is puzzled by this hard problem. Could you please help him solve it?

Input

The first line contains an even integer n (2 ≤ n ≤ 3 ⋅ 10^5), denoting that there are n integers on Bob's homework paper.

The second line contains n integers a_1, a_2, …, a_n (1 ≤ a_i ≤ 10^4), describing the numbers you need to deal with.

Output

A single line containing one integer, denoting the minimum of the sum of the square of s_j, which is $$$∑_{i = j}^{m} s_j^2, where m$$$ is the number of groups.

Examples

Input


4
8 5 2 3


Output


164


Input


6
1 1 1 2 2 2


Output


27

Note

In the first sample, one of the optimal solutions is to divide those 4 numbers into 2 groups \{2, 8\}, \{5, 3\}. Thus the answer is (2 + 8)^2 + (5 + 3)^2 = 164.

In the second sample, one of the optimal solutions is to divide those 6 numbers into 3 groups \{1, 2\}, \{1, 2\}, \{1, 2\}. Thus the answer is (1 + 2)^2 + (1 + 2)^2 + (1 + 2)^2 = 27.
import java.util.*;
import java.io.*;


public class Class{
    static DSU dsu;
    static RSQ t;
    static RMQ _t;
    static Heap h;
    final int INF = 1000000000;
    static int n;
    static TreeSet<Integer>d;
    static boolean used[];
    static ArrayList<Integer>gr[];
    static ArrayList<Integer>ans;
    static int dist[];
    static void dfs(int v){
            used[v] = true;
            ans.add(v);
        if(ans.size() == n)return;
        for (int i = 0; i < gr[v].size(); i++) {
            d.add(gr[v].get(i));
        }
        int t = d.pollFirst();
        while (used[t])t = d.pollFirst();
        dfs(t);
    }
    public static void main(String[] args) throws FileNotFoundException {
        Scanner in = new Scanner(System.in);
        n = in.nextInt();
        int a[] = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = in.nextInt();
        }
        Arrays.sort(a);
        long ans = 0;
        for (int i = 0; i < n / 2; i++) {
            ans += (a[i]+a[n-1-i])*(a[i]+a[n-1-i]);
        }
        System.out.println(ans);
        }
    void dijkstra(int st){
        boolean used[] = new boolean[n];
        TreeSet<Integer>q = new TreeSet<>(new Comparator<Integer>() {
            @Override
            public int compare(Integer o1, Integer o2) {
                return Integer.compare(dist[o1],dist[o2]);
            }
        });
        Arrays.fill(dist,INF);
        dist[st] = 0;
        q.add(0);
        while (!q.isEmpty()){
            int v = q.pollFirst();
            }
        }
    }

class RSQ{
    long a[];
    long t[];
    public RSQ(long[] a, long[]t) {
        this.a = a;
        this.t = t;
    }
    void build(int v, int tl, int tr){
        if(tl == tr)t[v] = a[tl];
        else{
            int tm = (tl+tr)/2;
            build(v*2,tl,tm);
            build(v*2+1,tm+1,tr);
            t[v] = t[v*2]+t[v*2+1];
        }
    }
    void update(int v, int tl, int tr, int pos, long val){
        if(tl == tr)t[v] = val;
        else{
            int tm = (tl+tr)/2;
            if(pos <= tm){
                update(v*2,tl,tm,pos,val);
            }else{
                update(v*2+1,tm+1,tr,pos,val);
            }
            t[v] = t[v*2]+t[v*2+1];
        }
    }
    long get(int v, int tl, int tr, int l, int r){
        if(tl > r || tr < l)return 0;
        if(l <= tl && r >= tr)return t[v];
        int tm = (tl+tr)/2;
        return get(v*2,tl,tm,l,r)+get(v*2+1,tm+1,tr,l,r);
    }
}
class RMQ{
    int []a ;
    int t[];
    public RMQ(int[] a, int t[]) {
        this.a = a;
        this.t = t;
        build(1,0,a.length-1);
    }
    void build(int v, int tl, int tr){
        if(tl == tr)t[v] = a[tl];
        else{
            int tm = (tl+tr)/2;
            build(v*2,tl,tm);
            build(v*2+1,tm+1,tr);
            t[v] = Math.min(t[v*2],t[v*2+1]);
        }
    }
    void update(int v,int tl, int tr, int pos, int val){
        if(tl == tr)t[v] = val;
        else{
            int tm = (tl+tr)/2;
            if(pos<=tm){
                update(v*2,tl,tm,pos,val);
            }else update(v*2+1,tm+1,tr,pos,val);
            t[v] = Math.min(t[v*2],t[v*2+1]);
        }
    }
    int get(int v, int tl, int tr, int l, int r){
        if(tr < l || tl > r)return Integer.MAX_VALUE;
        if(l <= tl && r >= tr)return t[v];
        int tm = (tl+tr)/2;
        return Math.min(get(v*2,tl,tm,l,r),get(v*2+1,tm+1,tr,l,r));
    }
}
class DSU{
    int par[];

    public DSU(int[] par) {
        this.par = par;
    }
    void make_set(int i){
        par[i] = i;
    }
    void union_sets(int a, int b){
      a = find_set(a);
      b = find_set(b);
      if(a!=b)par[a] = b;
    }
    int find_set(int a){
        if(par[a] == a)return a;
        else return par[a] = find_set(par[a]);
    }
}
class Heap {
    int[] h;
    int last;

    public Heap(int n) {
        h = new int[n];
        last = 1;
    }

    void siftUp(int i) {
        while (i / 2 > 0 && h[i] < h[i / 2]) {
            int t = h[i];
            h[i] = h[i / 2];
            h[i / 2] = t;
            i /= 2;
        }
    }

    void siftDown(int i) {
        int x = 2 * i;
        while (i != x && 2 * i < last) {
            x = i;
            if (i * 2 < last && h[x] > h[i * 2]) {
                x = 2 * i;
            }
            if (i * 2 + 1 < last && h[x] > h[i * 2 + 1]) {
                x = 2 * i + 1;
            }
            if (i != x) {
                int t = h[i];
                h[i] = h[x];
                h[x] = t;
                i = x;
                x = 2 * i;
            }
        }
    }
}
class Edge{
    int dir,w;
    public Edge(int dir, int w) {
        this.dir = dir;
        this.w = w;
    }
}
class P{
    int f, s;

    public P(int f, int s) {
        this.f = f;
        this.s = s;
    }
}
class C implements Comparator<Edge>{

    @Override
    public int compare(Edge o1, Edge o2) {
        return Double.compare(o1.w,o2.w);
    }
}