#include #define maxn 500000 int n; int a[maxn + 5]; int main() { scanf("%d", &n); for (int i = 1; i <= n; ++i) scanf("%d", &a[i]); bool ans = true; if (n == 2) ans = (a[1] - a[2]) % 2 == 0; else { for (int i = 1; i <= n; ++i) if ((a[i + 1] - a[i]) % (n - 2) != 0) ans = false; } if (ans) puts("Yes"); else puts("No"); return 0; }