#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10, inf = 1e9;
int n;
int a[maxn];
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  sort(a + 1, a + 1 + n);
  long long lsum = 0, rsum = 0;
  for (int i = 1; i <= n / 2; ++i) lsum += a[i];
  for (int i = n / 2 + 1; i <= n; ++i) rsum += a[i];
  long long ans = lsum * lsum + rsum * rsum;
  cout << ans << "\n";
  return 0;
}
