#include #define int long long using namespace std; signed main(){ int N; cin>>N; int prev,now; cin>>prev; int tmp; bool ans=true; for(int i=1;i>now; if(i!=1 and tmp!=now-prev){ ans=false; break; } prev=now; } cout<<(ans ? "YES" : "NO")<