#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, hypo, base = 0, height = 0;
  cin >> n;
  int a[n + 1];
  for (int i = 1; i < n + 1; i++) {
    cin >> a[i];
  }
  sort(a + 1, a + n + 1);
  for (int i = 1; i < n + 1; i++) {
    if (i <= n / 2) {
      base += a[i];
    } else {
      height += a[i];
    }
  }
  hypo = base * base + height * height;
  cout << hypo;
  return 0;
}
