#include using namespace std; #define ll long long void solve() { int n; cin >> n; vector a(n); for (int i = 0; i < n; ++i) cin >> a[i]; if (n == 1) { cout << "Yes"; return; } int t = a[0] + a[n - 1]; bool f = 0; for (int i = 0; i < n / 2; ++i) { if (!(a[i] + a[n - 1 - i] == t)) { f = 1; } } if (f) cout << "No"; else cout << "Yes"; } int main() { int tc = 1; // cin >> tc; while (tc--) { solve(); } }