#include int main() { int i, N, B[200001]; scanf("%d", &N); for (i = 1; i <= N; i++) scanf("%d", &(B[i])); int j, jj; for (i = 1, j = 2; i <= N; i++) { if (B[i] == 0) continue; if (i == N) break; if (j <= i) j = i + 1; if (B[i] % 2 != B[i+1] % 2) { for (; j < N; j++) if (B[j] % 2 == B[j+1] % 2) break; if (j == N) break; for (jj = j; jj > i; jj--) { if (B[jj] == 0 || B[jj+1] == 0) break; B[jj]--; B[jj+1]--; } } if (B[i] > B[i+1]) break; B[i+1] -= B[i]; B[i] = 0; } if (i > N) printf("Yes\n"); else printf("No\n"); fflush(stdout); return 0; }