#include<bits/stdc++.h>
using namespace std;
#define el "\n"
#define ll long long
#define ull unsigned long long
#define se second
#define fi first
#define be begin()
#define en end()
#define Faster cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
bool isExBalance(int *a, int n)
{
ll f[n] = {0};
f[0] = a[0];
if(n <= 2) return false;
for(int i = 1; i < n; i++)
{
f[i] = f[i-1] + a[i];
}
for(int i = 1; i < n - 1; i++)
{
if((f[n - 1] - f[i]) != 0 && f[i - 1] % (f[n - 1] - f[i]) == 0) return true;
}
return false;
}
int main()
{
Faster;
int n; cin >> n;
int *a = new int[n];
for(int i = 0; i < n; i++) cin >> a[i];
if(isExBalance(a, n)) cout << "YES";
else cout << "NO";
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKI2RlZmluZSBlbCAiXG4iCiNkZWZpbmUgbGwgbG9uZyBsb25nCiNkZWZpbmUgdWxsIHVuc2lnbmVkIGxvbmcgbG9uZwojZGVmaW5lIHNlIHNlY29uZAojZGVmaW5lIGZpIGZpcnN0CiNkZWZpbmUgYmUgYmVnaW4oKQojZGVmaW5lIGVuIGVuZCgpCiNkZWZpbmUgRmFzdGVyIGNpbi50aWUoMCk7IGNvdXQudGllKDApOyBpb3NfYmFzZTo6c3luY193aXRoX3N0ZGlvKDApOwpib29sIGlzRXhCYWxhbmNlKGludCAqYSwgaW50IG4pCnsKICAgIGxsIGZbbl0gPSB7MH07CiAgICBmWzBdID0gYVswXTsKICAgIGlmKG4gPD0gMikgcmV0dXJuIGZhbHNlOwogICAgZm9yKGludCBpID0gMTsgaSA8IG47IGkrKykKICAgIHsKICAgICAgICBmW2ldID0gZltpLTFdICsgYVtpXTsKICAgIH0KICAgIGZvcihpbnQgaSA9IDE7IGkgPCBuIC0gMTsgaSsrKQogICAgewogICAgICAgIGlmKChmW24gLSAxXSAtIGZbaV0pICE9IDAgJiYgZltpIC0gMV0gJSAoZltuIC0gMV0gLSBmW2ldKSA9PSAwKSByZXR1cm4gdHJ1ZTsKICAgIH0KICAgIHJldHVybiBmYWxzZTsKfQppbnQgbWFpbigpCnsKICAgIEZhc3RlcjsKICAgIGludCBuOyBjaW4gPj4gbjsKICAgIGludCAqYSA9IG5ldyBpbnRbbl07CiAgICBmb3IoaW50IGkgPSAwOyBpIDwgbjsgaSsrKSBjaW4gPj4gYVtpXTsKICAgIGlmKGlzRXhCYWxhbmNlKGEsIG4pKSBjb3V0IDw8ICJZRVMiOwogICAgZWxzZSBjb3V0IDw8ICJOTyI7Cgp9Cg==