### BUGGY CODE ###

N = int(input())
h_list = list(map(int, input().split()))
# print(N, h_list)

flag = True
# for i in range(0, N-1):
#     for j in range(i+1, N):
#         if (h_list[i]- h_list[j]) > 1:
#             flag = False
#             break
#     if not flag:
#         break

for i in range(0, N-1):
    i_v = h_list[i]
    min_v = min(h_list[i+1:N])
#    print(i_v, min_v, h_list[i+1:N])
    if i_v - min_v > 1:
        flag = False
        break


if flag:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

N = int(input())                                                                                                                                                                                                                                                                
h_list = list(map(int, input().split()))                                                                                                                                                                                                                                        
# print(N, h_list)                                                                                                                                                                                                                                                              
                                                                                                                                                                                                                                                                                
flag = True                                                                                                                                                                                                                                                                     
for i in reversed(range(1, N)):                                                                                                                                                                                                                                                 
    diff = h_list[i-1]- h_list[i]                                                                                                                                                                                                                                               
#    print(i, diff)                                                                                                                                                                                                                                                             
    if diff >= 2:                                                                                                                                                                                                                                                               
        flag = False                                                                                                                                                                                                                                                            
        break                                                                                                                                                                                                                                                                   
    elif diff == 1:                                                                                                                                                                                                                                                             
        h_list[i-1] -= 1                                                                                                                                                                                                                                                        
    else:                                                                                                                                                                                                                                                                       
        pass                                                                                                                                                                                                                                                                    
                                                                                                                                                                                                                                                                                
                                                                                                                                                                                                                                                                                
if flag:                                                                                                                                                                                                                                                                        
    print("Yes")                                                                                                                                                                                                                                                                
else:                                                                                                                                                                                                                                                                           
    print("No")