import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] A = new int[N];
    for (int i = 0; i < N; i++) {
      A[i] = sc.nextInt();
    }
 
    for (int i = 1; i < N; i++) {
      if (A[i - 1] < A[i]) {
        A[i]--;
      } 
      else {
        if (A[i - 1] != A[i]) {
          System.out.println("No");
          return;
        }
      }
    }
    System.out.println("Yes");
  }
} 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[] A = new int[N];
    for (int i = 0; i < N; i++) {
      A[i] = sc.nextInt();
    }
 
    for (int i = 1; i < N; i++) {
      if (A[i - 1] < A[i]) {
        A[i]--;
      } 
      else {
        if (A[i - 1] != A[i]) {
          System.out.println("No");
          return;
        }
      }
    }
    System.out.println("Yes");
  }
} Main public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] A = new int[N];
    for (int i = 0; i < N; i++) {
      A[i] = sc.nextInt();
    }
 
    for (int i = 1; i < N; i++) {
      if (A[i - 1] < A[i]) {
        A[i]--;
      } 
      else {
        if (A[i - 1] != A[i]) {
          System.out.println("No");
          return;
        }
      }
    }
    System.out.println("Yes");
  } main {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] A = new int[N];
    for (int i = 0; i < N; i++) {
      A[i] = sc.nextInt();
    }
 
    for (int i = 1; i < N; i++) {
      if (A[i - 1] < A[i]) {
        A[i]--;
      } 
      else {
        if (A[i - 1] != A[i]) {
          System.out.println("No");
          return;
        }
      }
    }
    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[] A = new int[N]; A new int[N] N for (int i = 0; i < N; i++) {
      A[i] = sc.nextInt();
    } int i = 0; int i = 0; i 0 i < N i N i++ i++ i {
      A[i] = sc.nextInt();
    } {
      A[i] = sc.nextInt();
    } A[i] = sc.nextInt() A[i] A i sc.nextInt() sc.nextInt sc for (int i = 1; i < N; i++) {
      if (A[i - 1] < A[i]) {
        A[i]--;
      } 
      else {
        if (A[i - 1] != A[i]) {
          System.out.println("No");
          return;
        }
      }
    } int i = 1; int i = 1; i 1 i < N i N i++ i++ i {
      if (A[i - 1] < A[i]) {
        A[i]--;
      } 
      else {
        if (A[i - 1] != A[i]) {
          System.out.println("No");
          return;
        }
      }
    } {
      if (A[i - 1] < A[i]) {
        A[i]--;
      } 
      else {
        if (A[i - 1] != A[i]) {
          System.out.println("No");
          return;
        }
      }
    } if (A[i - 1] < A[i]) {
        A[i]--;
      } 
      else {
        if (A[i - 1] != A[i]) {
          System.out.println("No");
          return;
        }
      } A[i - 1] < A[i] A[i - 1] A i - 1 i 1 A[i] A i {
        A[i]--;
      } A[i]-- A[i] A i {
        if (A[i - 1] != A[i]) {
          System.out.println("No");
          return;
        }
      } if (A[i - 1] != A[i]) {
          System.out.println("No");
          return;
        } A[i - 1] != A[i] A[i - 1] A i - 1 i 1 A[i] A i {
          System.out.println("No");
          return;
        } System.out.println("No") System.out.println System.out System System.out "No" return; 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[] A = new int[N];
    for (int i = 0; i < N; i++) {
      A[i] = sc.nextInt();
    }
 
    for (int i = 1; i < N; i++) {
      if (A[i - 1] < A[i]) {
        A[i]--;
      } 
      else {
        if (A[i - 1] != A[i]) {
          System.out.println("No");
          return;
        }
      }
    }
    System.out.println("Yes");
  }
} public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] A = new int[N];
    for (int i = 0; i < N; i++) {
      A[i] = sc.nextInt();
    }
 
    for (int i = 1; i < N; i++) {
      if (A[i - 1] < A[i]) {
        A[i]--;
      } 
      else {
        if (A[i - 1] != A[i]) {
          System.out.println("No");
          return;
        }
      }
    }
    System.out.println("Yes");
  }
} Main
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] A = new int[N];
    for (int i = 0; i < N; i++) {
      A[i] = sc.nextInt();
    }
 
    for (int i = 1; i < N; i++) {
      if (A[i - 1] < A[i]) {
        A[i]--;
      } 
      else {
        if (A[i - 1] != A[i]) {
          System.out.println("No");
          return;
        }
      }
    }
    System.out.println("Yes");
  }
}