import sys, time, random from collections import deque, Counter, defaultdict import logging from logging import debug, error, info, warning logging.basicConfig(level=logging.DEBUG) input = lambda: sys.stdin.readline().rstrip() ii = lambda: int(input()) mi = lambda: map(int, input().split()) li = lambda: list(mi()) inf = 2 ** 61 - 1 mod = 998244353 n = ii() a = [0] + li() + [0] A = [] if 1 not in a: print('No') exit() for i in range(n + 1): A.append(a[i + 1] - a[i]) cnt = 0 ans = 'Yes' for i in range(len(A)): cnt += A[i] if cnt < 0: ans = 'No' break if cnt != 0: ans = 'No' print(ans)