import java.util.Scanner;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int N = sc.nextInt();
   int[] Hi = new int[N];
   for(int i =0;i<N;i++)
   {
   Hi[i] = sc.nextInt();
   }
   int outcount=0;
   for(int k=0;k<N-1;k++)
   {
    if( Hi[k] < Hi[k+1] )
    {
    outcount=0;
    }
    else if (Hi[k] == Hi[k+1]){}
    else
    {
    if(Hi[k] == Hi[k+1]+1) outcount++;
    else outcount=2;
    }
    
    if(outcount==2) break;
   }
    if(outcount==2) System.out.println("No");
    else System.out.println("Yes");
 }
} import java.util.Scanner; Scanner java.util public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int N = sc.nextInt();
   int[] Hi = new int[N];
   for(int i =0;i<N;i++)
   {
   Hi[i] = sc.nextInt();
   }
   int outcount=0;
   for(int k=0;k<N-1;k++)
   {
    if( Hi[k] < Hi[k+1] )
    {
    outcount=0;
    }
    else if (Hi[k] == Hi[k+1]){}
    else
    {
    if(Hi[k] == Hi[k+1]+1) outcount++;
    else outcount=2;
    }
    
    if(outcount==2) break;
   }
    if(outcount==2) System.out.println("No");
    else System.out.println("Yes");
 }
} Main public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int N = sc.nextInt();
   int[] Hi = new int[N];
   for(int i =0;i<N;i++)
   {
   Hi[i] = sc.nextInt();
   }
   int outcount=0;
   for(int k=0;k<N-1;k++)
   {
    if( Hi[k] < Hi[k+1] )
    {
    outcount=0;
    }
    else if (Hi[k] == Hi[k+1]){}
    else
    {
    if(Hi[k] == Hi[k+1]+1) outcount++;
    else outcount=2;
    }
    
    if(outcount==2) break;
   }
    if(outcount==2) System.out.println("No");
    else System.out.println("Yes");
 } main {
   Scanner sc = new Scanner(System.in);
   int N = sc.nextInt();
   int[] Hi = new int[N];
   for(int i =0;i<N;i++)
   {
   Hi[i] = sc.nextInt();
   }
   int outcount=0;
   for(int k=0;k<N-1;k++)
   {
    if( Hi[k] < Hi[k+1] )
    {
    outcount=0;
    }
    else if (Hi[k] == Hi[k+1]){}
    else
    {
    if(Hi[k] == Hi[k+1]+1) outcount++;
    else outcount=2;
    }
    
    if(outcount==2) break;
   }
    if(outcount==2) System.out.println("No");
    else System.out.println("Yes");
 } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int N = sc.nextInt(); N sc.nextInt() sc.nextInt sc int[] Hi = new int[N]; Hi new int[N] N for(int i =0;i<N;i++)
   {
   Hi[i] = sc.nextInt();
   } int i =0; int i =0; i 0 i<N i N i++ i++ i {
   Hi[i] = sc.nextInt();
   } {
   Hi[i] = sc.nextInt();
   } Hi[i] = sc.nextInt() Hi[i] Hi i sc.nextInt() sc.nextInt sc int outcount=0; outcount 0 for(int k=0;k<N-1;k++)
   {
    if( Hi[k] < Hi[k+1] )
    {
    outcount=0;
    }
    else if (Hi[k] == Hi[k+1]){}
    else
    {
    if(Hi[k] == Hi[k+1]+1) outcount++;
    else outcount=2;
    }
    
    if(outcount==2) break;
   } int k=0; int k=0; k 0 k<N-1 k N-1 N 1 k++ k++ k {
    if( Hi[k] < Hi[k+1] )
    {
    outcount=0;
    }
    else if (Hi[k] == Hi[k+1]){}
    else
    {
    if(Hi[k] == Hi[k+1]+1) outcount++;
    else outcount=2;
    }
    
    if(outcount==2) break;
   } {
    if( Hi[k] < Hi[k+1] )
    {
    outcount=0;
    }
    else if (Hi[k] == Hi[k+1]){}
    else
    {
    if(Hi[k] == Hi[k+1]+1) outcount++;
    else outcount=2;
    }
    
    if(outcount==2) break;
   } if( Hi[k] < Hi[k+1] )
    {
    outcount=0;
    }
    else if (Hi[k] == Hi[k+1]){}
    else
    {
    if(Hi[k] == Hi[k+1]+1) outcount++;
    else outcount=2;
    } Hi[k] < Hi[k+1] Hi[k] Hi k Hi[k+1] Hi k+1 k 1 {
    outcount=0;
    } outcount=0 outcount 0 if (Hi[k] == Hi[k+1]){}
    else
    {
    if(Hi[k] == Hi[k+1]+1) outcount++;
    else outcount=2;
    } Hi[k] == Hi[k+1] Hi[k] Hi k Hi[k+1] Hi k+1 k 1 {} {
    if(Hi[k] == Hi[k+1]+1) outcount++;
    else outcount=2;
    } if(Hi[k] == Hi[k+1]+1) outcount++;
    else outcount=2; Hi[k] == Hi[k+1]+1 Hi[k] Hi k Hi[k+1]+1 Hi[k+1] Hi k+1 k 1 1 outcount++ outcount outcount=2 outcount 2 if(outcount==2) break; outcount==2 outcount 2 break; if(outcount==2) System.out.println("No");
    else System.out.println("Yes"); outcount==2 outcount 2 System.out.println("No") System.out.println System.out System System.out "No" System.out.println("Yes") System.out.println System.out System System.out "Yes" String[] args args public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int N = sc.nextInt();
   int[] Hi = new int[N];
   for(int i =0;i<N;i++)
   {
   Hi[i] = sc.nextInt();
   }
   int outcount=0;
   for(int k=0;k<N-1;k++)
   {
    if( Hi[k] < Hi[k+1] )
    {
    outcount=0;
    }
    else if (Hi[k] == Hi[k+1]){}
    else
    {
    if(Hi[k] == Hi[k+1]+1) outcount++;
    else outcount=2;
    }
    
    if(outcount==2) break;
   }
    if(outcount==2) System.out.println("No");
    else System.out.println("Yes");
 }
} public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int N = sc.nextInt();
   int[] Hi = new int[N];
   for(int i =0;i<N;i++)
   {
   Hi[i] = sc.nextInt();
   }
   int outcount=0;
   for(int k=0;k<N-1;k++)
   {
    if( Hi[k] < Hi[k+1] )
    {
    outcount=0;
    }
    else if (Hi[k] == Hi[k+1]){}
    else
    {
    if(Hi[k] == Hi[k+1]+1) outcount++;
    else outcount=2;
    }
    
    if(outcount==2) break;
   }
    if(outcount==2) System.out.println("No");
    else System.out.println("Yes");
 }
} Main
import java.util.Scanner;
public class Main{
 public static void main(String[] args){
   Scanner sc = new Scanner(System.in);
   int N = sc.nextInt();
   int[] Hi = new int[N];
   for(int i =0;i<N;i++)
   {
   Hi[i] = sc.nextInt();
   }
   int outcount=0;
   for(int k=0;k<N-1;k++)
   {
    if( Hi[k] < Hi[k+1] )
    {
    outcount=0;
    }
    else if (Hi[k] == Hi[k+1]){}
    else
    {
    if(Hi[k] == Hi[k+1]+1) outcount++;
    else outcount=2;
    }
    
    if(outcount==2) break;
   }
    if(outcount==2) System.out.println("No");
    else System.out.println("Yes");
 }
}