#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 5;
const int INF = 0x3f3f3f3f;
const int mod = 1e9 + 7;
const double Pi = acos(-1);
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
double dpow(double a, long long b) {
  double ans = 1.0;
  while (b) {
    if (b % 2) ans = ans * a;
    a = a * a;
    b /= 2;
  }
  return ans;
}
long long quick_pow(long long x, long long y) {
  long long ans = 1;
  while (y) {
    if (y & 1) {
      ans = ans * x % mod;
    }
    x = x * x % mod;
    y >>= 1;
  }
  return ans;
}
int a[maxn];
int main() {
  int n;
  scanf("%d", &n);
  long long sum = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    sum += a[i];
  }
  sort(a + 1, a + n + 1);
  int cnt = n / 2;
  int num1 = 0;
  for (int i = 1; i <= cnt; i++) {
    num1 += a[i];
  }
  long long ans = 1LL * (sum - num1) * (sum - num1) + 1LL * num1 * num1;
  printf("%lld\n", ans);
  return 0;
}
