#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, a[100100];
  cin >> n;
  for (int i = 0; i < (n); ++i) cin >> a[i];
  sort(a, a + n);
  long long first = 0, second = 0;
  int i = 0, j = n - 1;
  while (i <= j) {
    if (i == j)
      second += a[i];
    else {
      first += a[i];
      second += a[j];
    }
    i++;
    j--;
  }
  long long sol = (first * first) + (second * second);
  cout << sol << endl;
}
