#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  long long int x = 0, y = 0, s, q, p;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a + n);
  for (int i = 0; i < n / 2; i++) {
    x += a[i];
  }
  for (int i = n / 2; i < n; i++) {
    y += a[i];
  }
  p = x * x;
  q = y * y;
  s = p + q;
  cout << s;
  return 0;
}
