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")  

Measured memory_bytes: 14396