#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int t;
  t = 1;
  while (t--) {
    long long int n;
    cin >> n;
    long long int a[n];
    for (long long int i = 0; i < n; i++) {
      cin >> a[i];
    }
    sort(a, a + n);
    long long int x = 0, y = 0;
    long long int st = 0, en = n - 1;
    while (st <= en) {
      x += a[en--];
      if (st <= en) y += a[st++];
    }
    cout << (x * x) + (y * y) << "\n";
  }
  return 0;
}
