#include "bits/stdc++.h" using namespace std; int N; int A[200010]; signed main() { cin >> N; for (int i = 0; i < N; i++)cin >> A[i]; for (int i = 0; i < N; i++) { if (A[i] > i + 1) { cout << "No" << endl; return 0; } } bool ok = false; int cnt = 0; for (int i = N - 1; i >= 0; i--) { if (ok) { if (A[i] > i + 1) { cout << "No" << endl; return 0; } else if ((A[i] - i - 1 + cnt) % (i + 1) != 0) { cout << "No" << endl; return 0; } cnt++; } else { if (A[i] != 0) { ok = true; if (A[i] > i + 1) { cout << "No" << endl; return 0; } else if ((A[i] - i - 1 + cnt) % (i + 1) != 0) { cout << "No" << endl; return 0; } cnt++; } } } cout << "Yes" << endl; return 0; }