import java.util.*;
public class Main
{
  public static void main(String args[])
  {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int ar[] = new int[n];
    for(int i = 0;i<n;i++)
    {
      ar[i] = sc.nextInt();
    }
    boolean isComplete = true;
    for(int i = n-1;i>1;i--)
    {
      if(ar[i]>=ar[i-1])
      {
        continue;
      }
      ar[i-1]--;
      if(ar[i]>=ar[i-1]&&ar[i-1]>=0)
      {
        continue;
      }
      isComplete = false;
      break;
    }
    System.out.println(isComplete?"Yes":"No");
  }
} import java.util.*; util.* java public class Main
{
  public static void main(String args[])
  {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int ar[] = new int[n];
    for(int i = 0;i<n;i++)
    {
      ar[i] = sc.nextInt();
    }
    boolean isComplete = true;
    for(int i = n-1;i>1;i--)
    {
      if(ar[i]>=ar[i-1])
      {
        continue;
      }
      ar[i-1]--;
      if(ar[i]>=ar[i-1]&&ar[i-1]>=0)
      {
        continue;
      }
      isComplete = false;
      break;
    }
    System.out.println(isComplete?"Yes":"No");
  }
} Main public static void main(String args[])
  {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int ar[] = new int[n];
    for(int i = 0;i<n;i++)
    {
      ar[i] = sc.nextInt();
    }
    boolean isComplete = true;
    for(int i = n-1;i>1;i--)
    {
      if(ar[i]>=ar[i-1])
      {
        continue;
      }
      ar[i-1]--;
      if(ar[i]>=ar[i-1]&&ar[i-1]>=0)
      {
        continue;
      }
      isComplete = false;
      break;
    }
    System.out.println(isComplete?"Yes":"No");
  } main {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int ar[] = new int[n];
    for(int i = 0;i<n;i++)
    {
      ar[i] = sc.nextInt();
    }
    boolean isComplete = true;
    for(int i = n-1;i>1;i--)
    {
      if(ar[i]>=ar[i-1])
      {
        continue;
      }
      ar[i-1]--;
      if(ar[i]>=ar[i-1]&&ar[i-1]>=0)
      {
        continue;
      }
      isComplete = false;
      break;
    }
    System.out.println(isComplete?"Yes":"No");
  } Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int n = sc.nextInt(); n sc.nextInt() sc.nextInt sc int ar[] = new int[n]; ar new int[n] n for(int i = 0;i<n;i++)
    {
      ar[i] = sc.nextInt();
    } int i = 0; int i = 0; i 0 i<n i n i++ i++ i {
      ar[i] = sc.nextInt();
    } {
      ar[i] = sc.nextInt();
    } ar[i] = sc.nextInt() ar[i] ar i sc.nextInt() sc.nextInt sc boolean isComplete = true; isComplete true for(int i = n-1;i>1;i--)
    {
      if(ar[i]>=ar[i-1])
      {
        continue;
      }
      ar[i-1]--;
      if(ar[i]>=ar[i-1]&&ar[i-1]>=0)
      {
        continue;
      }
      isComplete = false;
      break;
    } int i = n-1; int i = n-1; i n-1 n 1 i>1 i 1 i-- i-- i {
      if(ar[i]>=ar[i-1])
      {
        continue;
      }
      ar[i-1]--;
      if(ar[i]>=ar[i-1]&&ar[i-1]>=0)
      {
        continue;
      }
      isComplete = false;
      break;
    } {
      if(ar[i]>=ar[i-1])
      {
        continue;
      }
      ar[i-1]--;
      if(ar[i]>=ar[i-1]&&ar[i-1]>=0)
      {
        continue;
      }
      isComplete = false;
      break;
    } if(ar[i]>=ar[i-1])
      {
        continue;
      } ar[i]>=ar[i-1] ar[i] ar i ar[i-1] ar i-1 i 1 {
        continue;
      } continue; ar[i-1]-- ar[i-1] ar i-1 i 1 if(ar[i]>=ar[i-1]&&ar[i-1]>=0)
      {
        continue;
      } ar[i]>=ar[i-1]&&ar[i-1]>=0 ar[i]>=ar[i-1] ar[i] ar i ar[i-1] ar i-1 i 1 ar[i-1]>=0 ar[i-1] ar i-1 i 1 0 {
        continue;
      } continue; isComplete = false isComplete false break; System.out.println(isComplete?"Yes":"No") System.out.println System.out System System.out isComplete?"Yes":"No" isComplete "Yes" "No" String args[] args public class Main
{
  public static void main(String args[])
  {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int ar[] = new int[n];
    for(int i = 0;i<n;i++)
    {
      ar[i] = sc.nextInt();
    }
    boolean isComplete = true;
    for(int i = n-1;i>1;i--)
    {
      if(ar[i]>=ar[i-1])
      {
        continue;
      }
      ar[i-1]--;
      if(ar[i]>=ar[i-1]&&ar[i-1]>=0)
      {
        continue;
      }
      isComplete = false;
      break;
    }
    System.out.println(isComplete?"Yes":"No");
  }
} public class Main
{
  public static void main(String args[])
  {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int ar[] = new int[n];
    for(int i = 0;i<n;i++)
    {
      ar[i] = sc.nextInt();
    }
    boolean isComplete = true;
    for(int i = n-1;i>1;i--)
    {
      if(ar[i]>=ar[i-1])
      {
        continue;
      }
      ar[i-1]--;
      if(ar[i]>=ar[i-1]&&ar[i-1]>=0)
      {
        continue;
      }
      isComplete = false;
      break;
    }
    System.out.println(isComplete?"Yes":"No");
  }
} Main
import java.util.*;
public class Main
{
  public static void main(String args[])
  {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int ar[] = new int[n];
    for(int i = 0;i<n;i++)
    {
      ar[i] = sc.nextInt();
    }
    boolean isComplete = true;
    for(int i = n-1;i>1;i--)
    {
      if(ar[i]>=ar[i-1])
      {
        continue;
      }
      ar[i-1]--;
      if(ar[i]>=ar[i-1]&&ar[i-1]>=0)
      {
        continue;
      }
      isComplete = false;
      break;
    }
    System.out.println(isComplete?"Yes":"No");
  }
}