#include #include using namespace std; int N; int E[20]; int power3[20]; int main() { // Step #1. 入力 cin >> N; for (int i = 0; i < N; i++) cin >> E[i]; assert(3 <= N && N <= 12); for (int i = 0; i < N; i++) assert(1 <= E[i] && E[i] <= 10000000); // Step #2. 前処理 power3[0] = 1; for (int i = 1; i <= N; i++) power3[i] = 3 * power3[i - 1]; // Step #3. 探索 for (int i = 0; i < power3[N]; i++) { int sumA = 0, sumB = 0, sumC = 0; for (int j = 0; j < N; j++) { int bit = (i / power3[j]) % 3; if (bit == 0) sumA += E[j]; if (bit == 1) sumB += E[j]; if (bit == 2) sumC += E[j]; } if (sumA == sumB && sumB == sumC) { cout << "Yes" << endl; return 0; } } cout << "No" << endl; return 0; }