#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void fileIO() {}
int main() {
  fileIO();
  int n;
  scanf("%d", &n);
  ll a[n];
  ll sum1 = 0, sum2 = 0;
  for (int i = 0; i < n; i++) {
    scanf("%lld", a + i);
    sum1 += a[i];
  }
  sort(a, a + n);
  for (int i = 0; i < n / 2; i++) sum2 += a[i];
  sum1 -= sum2;
  printf("%lld\n", sum1 * sum1 + sum2 * sum2);
}
