#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  int n, temp, low, high;
  long long int w = 0;
  long long int h = 0;
  int a[200000];
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a + n);
  low = n / 2;
  for (int i = 0; i < low; i++) {
    w += a[i];
  }
  for (int i = low; i < n; i++) {
    h += a[i];
  }
  cout << w * w + h * h << endl;
  return 0;
}
