#include int main() { int i, N, B[200001]; scanf("%d", &N); for (i = 1; i <= N; i++) scanf("%d", &(B[i])); int j; for (i = 1; i <= N; i++) { if (B[i] == 0) continue; if (i == N) break; if (B[i] % 2 != B[i+1] % 2) { for (j = i + 1; j < N; j++) if (B[j] % 2 == B[j+1] % 2) break; if (j == N) break; for (; j > i; j--) { if (B[j] == 0 || B[j+1] == 0) break; B[j]--; B[j+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; }