import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

    int n = Integer.parseInt(in.readLine());
    String[] str = in.readLine().split(" ");
    
    int[] h = new int[n];
    for(int i=0; i<n; i++) {
      h[i] = Integer.parseInt(str[i]);
    }
    
    in.close();
    
    boolean hantei = true;
    
    for(int i=n-1; i>0; i--) {
      if(h.length==1) {
        System.out.println("Yes");
        return;
        
      } else if(h[i]<h[i-1]-1) {
        System.out.println("No");
        return;
        
      } else if(h[i]==h[i-1]-1) {
        h[i-1] -= 1;
      }
    }
    
    System.out.println("Yes");
  }
} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.io.IOException; IOException java.io public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

    int n = Integer.parseInt(in.readLine());
    String[] str = in.readLine().split(" ");
    
    int[] h = new int[n];
    for(int i=0; i<n; i++) {
      h[i] = Integer.parseInt(str[i]);
    }
    
    in.close();
    
    boolean hantei = true;
    
    for(int i=n-1; i>0; i--) {
      if(h.length==1) {
        System.out.println("Yes");
        return;
        
      } else if(h[i]<h[i-1]-1) {
        System.out.println("No");
        return;
        
      } else if(h[i]==h[i-1]-1) {
        h[i-1] -= 1;
      }
    }
    
    System.out.println("Yes");
  }
} Main public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

    int n = Integer.parseInt(in.readLine());
    String[] str = in.readLine().split(" ");
    
    int[] h = new int[n];
    for(int i=0; i<n; i++) {
      h[i] = Integer.parseInt(str[i]);
    }
    
    in.close();
    
    boolean hantei = true;
    
    for(int i=n-1; i>0; i--) {
      if(h.length==1) {
        System.out.println("Yes");
        return;
        
      } else if(h[i]<h[i-1]-1) {
        System.out.println("No");
        return;
        
      } else if(h[i]==h[i-1]-1) {
        h[i-1] -= 1;
      }
    }
    
    System.out.println("Yes");
  } main {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

    int n = Integer.parseInt(in.readLine());
    String[] str = in.readLine().split(" ");
    
    int[] h = new int[n];
    for(int i=0; i<n; i++) {
      h[i] = Integer.parseInt(str[i]);
    }
    
    in.close();
    
    boolean hantei = true;
    
    for(int i=n-1; i>0; i--) {
      if(h.length==1) {
        System.out.println("Yes");
        return;
        
      } else if(h[i]<h[i-1]-1) {
        System.out.println("No");
        return;
        
      } else if(h[i]==h[i-1]-1) {
        h[i-1] -= 1;
      }
    }
    
    System.out.println("Yes");
  } BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); in new BufferedReader(new InputStreamReader(System.in)) int n = Integer.parseInt(in.readLine()); n Integer.parseInt(in.readLine()) Integer.parseInt Integer in.readLine() in.readLine in String[] str = in.readLine().split(" "); str in.readLine().split(" ") in.readLine().split in.readLine() in.readLine in " " int[] h = new int[n]; h new int[n] n for(int i=0; i<n; i++) {
      h[i] = Integer.parseInt(str[i]);
    } int i=0; int i=0; i 0 i<n i n i++ i++ i {
      h[i] = Integer.parseInt(str[i]);
    } {
      h[i] = Integer.parseInt(str[i]);
    } h[i] = Integer.parseInt(str[i]) h[i] h i Integer.parseInt(str[i]) Integer.parseInt Integer str[i] str i in.close() in.close in boolean hantei = true; hantei true for(int i=n-1; i>0; i--) {
      if(h.length==1) {
        System.out.println("Yes");
        return;
        
      } else if(h[i]<h[i-1]-1) {
        System.out.println("No");
        return;
        
      } else if(h[i]==h[i-1]-1) {
        h[i-1] -= 1;
      }
    } int i=n-1; int i=n-1; i n-1 n 1 i>0 i 0 i-- i-- i {
      if(h.length==1) {
        System.out.println("Yes");
        return;
        
      } else if(h[i]<h[i-1]-1) {
        System.out.println("No");
        return;
        
      } else if(h[i]==h[i-1]-1) {
        h[i-1] -= 1;
      }
    } {
      if(h.length==1) {
        System.out.println("Yes");
        return;
        
      } else if(h[i]<h[i-1]-1) {
        System.out.println("No");
        return;
        
      } else if(h[i]==h[i-1]-1) {
        h[i-1] -= 1;
      }
    } if(h.length==1) {
        System.out.println("Yes");
        return;
        
      } else if(h[i]<h[i-1]-1) {
        System.out.println("No");
        return;
        
      } else if(h[i]==h[i-1]-1) {
        h[i-1] -= 1;
      } h.length==1 h.length h h.length 1 {
        System.out.println("Yes");
        return;
        
      } System.out.println("Yes") System.out.println System.out System System.out "Yes" return; if(h[i]<h[i-1]-1) {
        System.out.println("No");
        return;
        
      } else if(h[i]==h[i-1]-1) {
        h[i-1] -= 1;
      } h[i]<h[i-1]-1 h[i] h i h[i-1]-1 h[i-1] h i-1 i 1 1 {
        System.out.println("No");
        return;
        
      } System.out.println("No") System.out.println System.out System System.out "No" return; if(h[i]==h[i-1]-1) {
        h[i-1] -= 1;
      } h[i]==h[i-1]-1 h[i] h i h[i-1]-1 h[i-1] h i-1 i 1 1 {
        h[i-1] -= 1;
      } h[i-1] -= 1 h[i-1] h i-1 i 1 1 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) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

    int n = Integer.parseInt(in.readLine());
    String[] str = in.readLine().split(" ");
    
    int[] h = new int[n];
    for(int i=0; i<n; i++) {
      h[i] = Integer.parseInt(str[i]);
    }
    
    in.close();
    
    boolean hantei = true;
    
    for(int i=n-1; i>0; i--) {
      if(h.length==1) {
        System.out.println("Yes");
        return;
        
      } else if(h[i]<h[i-1]-1) {
        System.out.println("No");
        return;
        
      } else if(h[i]==h[i-1]-1) {
        h[i-1] -= 1;
      }
    }
    
    System.out.println("Yes");
  }
} public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

    int n = Integer.parseInt(in.readLine());
    String[] str = in.readLine().split(" ");
    
    int[] h = new int[n];
    for(int i=0; i<n; i++) {
      h[i] = Integer.parseInt(str[i]);
    }
    
    in.close();
    
    boolean hantei = true;
    
    for(int i=n-1; i>0; i--) {
      if(h.length==1) {
        System.out.println("Yes");
        return;
        
      } else if(h[i]<h[i-1]-1) {
        System.out.println("No");
        return;
        
      } else if(h[i]==h[i-1]-1) {
        h[i-1] -= 1;
      }
    }
    
    System.out.println("Yes");
  }
} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

public class Main {
  public static void main(String[] args) throws IOException {
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));

    int n = Integer.parseInt(in.readLine());
    String[] str = in.readLine().split(" ");
    
    int[] h = new int[n];
    for(int i=0; i<n; i++) {
      h[i] = Integer.parseInt(str[i]);
    }
    
    in.close();
    
    boolean hantei = true;
    
    for(int i=n-1; i>0; i--) {
      if(h.length==1) {
        System.out.println("Yes");
        return;
        
      } else if(h[i]<h[i-1]-1) {
        System.out.println("No");
        return;
        
      } else if(h[i]==h[i-1]-1) {
        h[i-1] -= 1;
      }
    }
    
    System.out.println("Yes");
  }
}