import java.util.*;
public class Main {
public static void main(String args[])
{
  Scanner sp=new Scanner(System.in);
    int n=sp.nextInt();
    int ar[]=new int[n];
    int sc=0;
    int sn=0;
    int pre=0;
    for(int i=0;i<n;i++)
    {
      ar[i]=sp.nextInt();
    }
    for(int i=0;i<n;i++)    
    {
      
       if(pre==ar[i])
          {
              pre=ar[i];
          }
      if(pre<ar[i])
      {
          
        ar[i]-=1;
        pre=ar[i];

      }
      else{
        
        pre=ar[i];
        
      }
    }
    
    pre=0;

    
      for(int i=0;i<n;i++)
    {
      if(pre<=ar[i])
      {
        pre=ar[i];
      }
      else{
        sc++;
      }
    }
    if(sc>0)
    {
System.out.print("No");
    }
    else{
    System.out.print("Yes");
    }

}
} import java.util.*; util.* java public class Main {
public static void main(String args[])
{
  Scanner sp=new Scanner(System.in);
    int n=sp.nextInt();
    int ar[]=new int[n];
    int sc=0;
    int sn=0;
    int pre=0;
    for(int i=0;i<n;i++)
    {
      ar[i]=sp.nextInt();
    }
    for(int i=0;i<n;i++)    
    {
      
       if(pre==ar[i])
          {
              pre=ar[i];
          }
      if(pre<ar[i])
      {
          
        ar[i]-=1;
        pre=ar[i];

      }
      else{
        
        pre=ar[i];
        
      }
    }
    
    pre=0;

    
      for(int i=0;i<n;i++)
    {
      if(pre<=ar[i])
      {
        pre=ar[i];
      }
      else{
        sc++;
      }
    }
    if(sc>0)
    {
System.out.print("No");
    }
    else{
    System.out.print("Yes");
    }

}
} Main public static void main(String args[])
{
  Scanner sp=new Scanner(System.in);
    int n=sp.nextInt();
    int ar[]=new int[n];
    int sc=0;
    int sn=0;
    int pre=0;
    for(int i=0;i<n;i++)
    {
      ar[i]=sp.nextInt();
    }
    for(int i=0;i<n;i++)    
    {
      
       if(pre==ar[i])
          {
              pre=ar[i];
          }
      if(pre<ar[i])
      {
          
        ar[i]-=1;
        pre=ar[i];

      }
      else{
        
        pre=ar[i];
        
      }
    }
    
    pre=0;

    
      for(int i=0;i<n;i++)
    {
      if(pre<=ar[i])
      {
        pre=ar[i];
      }
      else{
        sc++;
      }
    }
    if(sc>0)
    {
System.out.print("No");
    }
    else{
    System.out.print("Yes");
    }

} main {
  Scanner sp=new Scanner(System.in);
    int n=sp.nextInt();
    int ar[]=new int[n];
    int sc=0;
    int sn=0;
    int pre=0;
    for(int i=0;i<n;i++)
    {
      ar[i]=sp.nextInt();
    }
    for(int i=0;i<n;i++)    
    {
      
       if(pre==ar[i])
          {
              pre=ar[i];
          }
      if(pre<ar[i])
      {
          
        ar[i]-=1;
        pre=ar[i];

      }
      else{
        
        pre=ar[i];
        
      }
    }
    
    pre=0;

    
      for(int i=0;i<n;i++)
    {
      if(pre<=ar[i])
      {
        pre=ar[i];
      }
      else{
        sc++;
      }
    }
    if(sc>0)
    {
System.out.print("No");
    }
    else{
    System.out.print("Yes");
    }

} Scanner sp=new Scanner(System.in); sp new Scanner(System.in) int n=sp.nextInt(); n sp.nextInt() sp.nextInt sp int ar[]=new int[n]; ar new int[n] n int sc=0; sc 0 int sn=0; sn 0 int pre=0; pre 0 for(int i=0;i<n;i++)
    {
      ar[i]=sp.nextInt();
    } int i=0; int i=0; i 0 i<n i n i++ i++ i {
      ar[i]=sp.nextInt();
    } {
      ar[i]=sp.nextInt();
    } ar[i]=sp.nextInt() ar[i] ar i sp.nextInt() sp.nextInt sp for(int i=0;i<n;i++)    
    {
      
       if(pre==ar[i])
          {
              pre=ar[i];
          }
      if(pre<ar[i])
      {
          
        ar[i]-=1;
        pre=ar[i];

      }
      else{
        
        pre=ar[i];
        
      }
    } int i=0; int i=0; i 0 i<n i n i++ i++ i {
      
       if(pre==ar[i])
          {
              pre=ar[i];
          }
      if(pre<ar[i])
      {
          
        ar[i]-=1;
        pre=ar[i];

      }
      else{
        
        pre=ar[i];
        
      }
    } {
      
       if(pre==ar[i])
          {
              pre=ar[i];
          }
      if(pre<ar[i])
      {
          
        ar[i]-=1;
        pre=ar[i];

      }
      else{
        
        pre=ar[i];
        
      }
    } if(pre==ar[i])
          {
              pre=ar[i];
          } pre==ar[i] pre ar[i] ar i {
              pre=ar[i];
          } pre=ar[i] pre ar[i] ar i if(pre<ar[i])
      {
          
        ar[i]-=1;
        pre=ar[i];

      }
      else{
        
        pre=ar[i];
        
      } pre<ar[i] pre ar[i] ar i {
          
        ar[i]-=1;
        pre=ar[i];

      } ar[i]-=1 ar[i] ar i 1 pre=ar[i] pre ar[i] ar i {
        
        pre=ar[i];
        
      } pre=ar[i] pre ar[i] ar i pre=0 pre 0 for(int i=0;i<n;i++)
    {
      if(pre<=ar[i])
      {
        pre=ar[i];
      }
      else{
        sc++;
      }
    } int i=0; int i=0; i 0 i<n i n i++ i++ i {
      if(pre<=ar[i])
      {
        pre=ar[i];
      }
      else{
        sc++;
      }
    } {
      if(pre<=ar[i])
      {
        pre=ar[i];
      }
      else{
        sc++;
      }
    } if(pre<=ar[i])
      {
        pre=ar[i];
      }
      else{
        sc++;
      } pre<=ar[i] pre ar[i] ar i {
        pre=ar[i];
      } pre=ar[i] pre ar[i] ar i {
        sc++;
      } sc++ sc if(sc>0)
    {
System.out.print("No");
    }
    else{
    System.out.print("Yes");
    } sc>0 sc 0 {
System.out.print("No");
    } System.out.print("No") System.out.print System.out System System.out "No" {
    System.out.print("Yes");
    } System.out.print("Yes") System.out.print System.out System System.out "Yes" String args[] args public class Main {
public static void main(String args[])
{
  Scanner sp=new Scanner(System.in);
    int n=sp.nextInt();
    int ar[]=new int[n];
    int sc=0;
    int sn=0;
    int pre=0;
    for(int i=0;i<n;i++)
    {
      ar[i]=sp.nextInt();
    }
    for(int i=0;i<n;i++)    
    {
      
       if(pre==ar[i])
          {
              pre=ar[i];
          }
      if(pre<ar[i])
      {
          
        ar[i]-=1;
        pre=ar[i];

      }
      else{
        
        pre=ar[i];
        
      }
    }
    
    pre=0;

    
      for(int i=0;i<n;i++)
    {
      if(pre<=ar[i])
      {
        pre=ar[i];
      }
      else{
        sc++;
      }
    }
    if(sc>0)
    {
System.out.print("No");
    }
    else{
    System.out.print("Yes");
    }

}
} public class Main {
public static void main(String args[])
{
  Scanner sp=new Scanner(System.in);
    int n=sp.nextInt();
    int ar[]=new int[n];
    int sc=0;
    int sn=0;
    int pre=0;
    for(int i=0;i<n;i++)
    {
      ar[i]=sp.nextInt();
    }
    for(int i=0;i<n;i++)    
    {
      
       if(pre==ar[i])
          {
              pre=ar[i];
          }
      if(pre<ar[i])
      {
          
        ar[i]-=1;
        pre=ar[i];

      }
      else{
        
        pre=ar[i];
        
      }
    }
    
    pre=0;

    
      for(int i=0;i<n;i++)
    {
      if(pre<=ar[i])
      {
        pre=ar[i];
      }
      else{
        sc++;
      }
    }
    if(sc>0)
    {
System.out.print("No");
    }
    else{
    System.out.print("Yes");
    }

}
} Main
import java.util.*;
public class Main {
public static void main(String args[])
{
  Scanner sp=new Scanner(System.in);
    int n=sp.nextInt();
    int ar[]=new int[n];
    int sc=0;
    int sn=0;
    int pre=0;
    for(int i=0;i<n;i++)
    {
      ar[i]=sp.nextInt();
    }
    for(int i=0;i<n;i++)    
    {
      
       if(pre==ar[i])
          {
              pre=ar[i];
          }
      if(pre<ar[i])
      {
          
        ar[i]-=1;
        pre=ar[i];

      }
      else{
        
        pre=ar[i];
        
      }
    }
    
    pre=0;

    
      for(int i=0;i<n;i++)
    {
      if(pre<=ar[i])
      {
        pre=ar[i];
      }
      else{
        sc++;
      }
    }
    if(sc>0)
    {
System.out.print("No");
    }
    else{
    System.out.print("Yes");
    }

}
}
