#include using namespace std; using ll = long long; int main(){ ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector a(n); for(auto &&v : a) cin >> v; int vl = a[0] + a.back(); int l = 0, r = n - 1; while(l <= r){ if(a[l] + a[r] != vl){ cout << "No\n"; return 0; } l++, r--; } cout << "Yes\n"; }