import java.util.*;

public class Main {
    public static void main(String args[]) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        int prev = 0;
        while(n-- > 0) {
        	int num = sc.nextInt();
        	if(num > prev) {
        		prev = num - 1;
        	} else if(num < prev) {
        		System.out.println("No");
        		return;
        	}
        }
        System.out.println("Yes");
    }
} import java.util.*; util.* java public class Main {
    public static void main(String args[]) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        int prev = 0;
        while(n-- > 0) {
        	int num = sc.nextInt();
        	if(num > prev) {
        		prev = num - 1;
        	} else if(num < prev) {
        		System.out.println("No");
        		return;
        	}
        }
        System.out.println("Yes");
    }
} Main public static void main(String args[]) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        int prev = 0;
        while(n-- > 0) {
        	int num = sc.nextInt();
        	if(num > prev) {
        		prev = num - 1;
        	} else if(num < prev) {
        		System.out.println("No");
        		return;
        	}
        }
        System.out.println("Yes");
    } main {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        int prev = 0;
        while(n-- > 0) {
        	int num = sc.nextInt();
        	if(num > prev) {
        		prev = num - 1;
        	} else if(num < prev) {
        		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 prev = 0; prev 0 while(n-- > 0) {
        	int num = sc.nextInt();
        	if(num > prev) {
        		prev = num - 1;
        	} else if(num < prev) {
        		System.out.println("No");
        		return;
        	}
        } n-- > 0 n-- n 0 {
        	int num = sc.nextInt();
        	if(num > prev) {
        		prev = num - 1;
        	} else if(num < prev) {
        		System.out.println("No");
        		return;
        	}
        } int num = sc.nextInt(); num sc.nextInt() sc.nextInt sc if(num > prev) {
        		prev = num - 1;
        	} else if(num < prev) {
        		System.out.println("No");
        		return;
        	} num > prev num prev {
        		prev = num - 1;
        	} prev = num - 1 prev num - 1 num 1 if(num < prev) {
        		System.out.println("No");
        		return;
        	} num < prev num prev {
        		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[]) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        int prev = 0;
        while(n-- > 0) {
        	int num = sc.nextInt();
        	if(num > prev) {
        		prev = num - 1;
        	} else if(num < prev) {
        		System.out.println("No");
        		return;
        	}
        }
        System.out.println("Yes");
    }
} public class Main {
    public static void main(String args[]) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        int prev = 0;
        while(n-- > 0) {
        	int num = sc.nextInt();
        	if(num > prev) {
        		prev = num - 1;
        	} else if(num < prev) {
        		System.out.println("No");
        		return;
        	}
        }
        System.out.println("Yes");
    }
} Main
import java.util.*;

public class Main {
    public static void main(String args[]) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        int prev = 0;
        while(n-- > 0) {
        	int num = sc.nextInt();
        	if(num > prev) {
        		prev = num - 1;
        	} else if(num < prev) {
        		System.out.println("No");
        		return;
        	}
        }
        System.out.println("Yes");
    }
}
