#include <bits/stdc++.h>
using namespace std;
const long long maxinput = 100005;
const long long inf = 1e9 + 7;
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  vector<long long> vec;
  for (long long i = 0; i < n; i++) {
    long long temp;
    cin >> temp;
    vec.push_back(temp);
  }
  long long y = 0;
  long long x = 0;
  sort(vec.begin(), vec.end());
  for (long long i = 0; i < n / 2; i++) y += vec[i];
  for (long long i = (n / 2); i < n; i++) x += vec[i];
  cout << x * x + y * y << endl;
}
