#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long arr[n];
  for (long long i = 0; i < n; i++) cin >> arr[i];
  sort(arr, arr + n);
  long long x = 0;
  long long y = 0;
  for (long long i = 0; i < n / 2; i++) {
    y = y + arr[i];
  }
  for (long long i = n / 2; i < n; i++) {
    x = x + arr[i];
  }
  cout << (x * x + y * y);
}
