#include
using namespace std;
int main() {
int n,x,sum,sum1,sum2;
cin >> n;
sum1 = sum2 = sum = 0;
for (int i = 0; i < n; i++) {
cin >> x;
sum += x;
sum1 += x*x;
sum2 += x*x*x;
}
if (sum % 2 == 0)
cout << sum1 << endl;<br> else
cout << sum2 << endl;<br>
system("pause");
return 0;
}