def main():
    n = int(input())
    h = list(map(int, input().split()))
    pre = h[0]
    for hh in h:
        if hh < pre - 1:
            print('No')
            return
        pre = max(pre, hh)
    print('Yes')


if __name__ == '__main__':
    main()

ffd83ddfcefda724d3c36aaa41a4b062dcf5bb0d
<mask token>

def main():
    n = int(input())
    h = list(map(int, input().split()))
    pre = h[0]
    for hh in h:
        if hh < pre - 1:
            print('No')
            return
        pre = max(pre, hh)
    print('Yes')


<mask token>

def main():
    n = int(input())
    h = list(map(int, input().split()))
    pre = h[0]
    for hh in h:
        if hh < pre - 1:
            print('No')
            return
        pre = max(pre, hh)
    print('Yes')


if __name__ == '__main__':
    main()
