#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<long long> v(n);
  for (auto &i : v) cin >> i;
  sort(v.begin(), v.end(), greater<int>());
  long long ans1 = 0, ans2 = 0;
  int x = (int)ceil(1.0 * n / 2);
  for (int i = 0; i < x; i++) {
    ans1 += v[i];
  }
  for (int i = x; i < n; i++) {
    ans2 += v[i];
  }
  long long ans = ans1 * ans1 + ans2 * ans2;
  cout << ans << "\n";
  return 0;
}
