#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
int a[maxn];
long long ans;
int n;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  sort(a + 1, a + 1 + n);
  long long sum1 = 0;
  long long sum2 = 0;
  for (int i = 1; i <= n / 2; i++) sum1 += (long long)a[i];
  for (int i = n / 2 + 1; i <= n; i++) sum2 += (long long)a[i];
  printf("%lld", sum1 * sum1 + sum2 * sum2);
  return 0;
}
