# Solution

$y \times 2 + f_x = sum$

$y + f_x = a_x$

$y = sum - a_x, f_x = sum - 2 \times y$

# Code

/*
_______                       ________                        _______
/ _____ \                     / ______ \                      / _____ \
/ /     \_\  _     __     _   / /      \ \   _     __     _   / /     \_\
| |          | |   |  |   | | | |        | | | |   |  |   | | | |
| |          | |   |  |   | | | |     __ | | | |   |  |   | | | |
| |       __ \  \  |  |  /  / | |     \ \| | \  \  |  |  /  / | |       __
\ \_____/ /  \  \/ /\ \/  /   \ \_____\  /   \  \/ /\ \/  /   \ \_____/ /
\_______/    \___/  \___/     \______/\__\   \___/  \___/     \_______/
*/
#include <iostream>
#include <cstdio>
#include <cstring>

using namespace std;

const int N = 1e5;

int head[N + 50], num, a[N + 50], f[N + 50], n, root, in[N + 50], flag = 1;

struct Node{
int next, to;
} edge[N * 2 + 50];

return;
}

void Dfs(int x, int fa){
if (in[x] == 1) { f[x] = a[x]; return; }
int sum = 0, maxx = 0;
for (int i = head[x]; i && flag; i = edge[i].next){
int v = edge[i].to;
if (v == fa) continue;
Dfs(v, x);
sum += f[v]; maxx = max(maxx, f[v]);
}
if (!flag) return;
int y = sum - a[x];
f[x] = sum - y * 2;
if (f[x] > a[x]) { flag = 0; return; }
if (min(sum / 2, sum - maxx) < y) { flag = 0; return; }
if (x == root && f[x] != 0) { flag = 0; return; }
}

{
x = 0; int p = 0; char st = getchar();
while (st < '0' || st > '9') p = (st == '-'), st = getchar();
while (st >= '0' && st <= '9') x = (x << 1) + (x << 3) + st - '0', st = getchar();
x = p ? -x : x;
return;
}

int main()
{
for (int i = 1; i <= n; i++) Read(a[i]);
if (n == 2){
if (a[1] == a[2]) puts("YES");
else puts("NO");
return 0;
}