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