#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const long long INFLL = 1e18;
const int MOD = 1e9 + 7;
const int MAXN = 2e5 + 5;
int n;
int a[MAXN];
multiset<int> s;
int get_mn() {
  if (s.empty()) return 0;
  int ret = *(s.begin());
  s.erase(s.begin());
  return ret;
}
int get_mx() {
  if (s.empty()) return 0;
  auto it = s.end();
  it--;
  int ret = *it;
  s.erase(it);
  return ret;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    s.insert(a[i]);
  }
  long long xs = 0, ys = 0;
  for (int i = 0; i < n; i++) {
    if (i & 1) {
      ys += get_mn();
    } else {
      xs += get_mx();
    }
  }
  printf("%lld\n", xs * xs + ys * ys);
  return 0;
}
