#include <bits/stdc++.h>   using namespace std;   int main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     long long int n;     cin >> n;     map<long long int, long long int> mp;     vector<long long int> v(n);     vector<long long int> cSum(n, 0);     for (long long int i = 0; i < n; i++) {       cin >> v[i];       mp[v[i]]++;     }     cSum[0] = v[0];     for (long long int i = 1; i < n; i++) {       cSum[i] = cSum[i - 1] + v[i];     }     if (cSum[n - 1] % 2 != 0) {       cout <<  NO ;     } else {       int flag2 = 0;       set<long long int> st;       for (long long int i = 0; i < n; i++) {         mp[v[i]]--;         long long int sum1 = cSum[i];         long long int sum2 = cSum[n - 1] - cSum[i];         long long int t = sum1 + sum2;         long long int each = t / 2;         if (each == sum1 && each == sum2) {           flag2 = 1;           break;         }         if (sum1 < sum2) {           long long int diff = each - sum1;           if (mp[diff] > 0) {             flag2 = 1;             break;           }         }         if (sum1 > sum2) {           long long int diff = each - sum2;           if (st.find(diff) != st.end()) {             flag2 = 1;             break;           }         }         st.insert(v[i]);       }       if (flag2 == 0) {         cout <<  NO ;       } else {         cout <<  YES ;       }     }     return 0;   }   