import java.util.Scanner; import java.util.Stack; public class Main { public static void main(String[] args) { int n = 0; Scanner in = new Scanner(System.in); while ((n = in.nextInt()) != 0) { int a[] = new int[100]; for (int i = 0; i < n; i++) a[i] = in.nextInt(); Stack s = new Stack(); int index = 0; for (int i = 1; i <= n; i++) { s.add(i); while(!s.isEmpty()){ if (Integer.parseInt(s.lastElement().toString()) == a[index]) { index++; s.pop(); }else break; } } if (s.isEmpty()) System.out.println("Yes"); else System.out.println("No"); } } } /************************************************************** Problem: 2119 User: admin Language: Java Result: Accepted Time:821 ms Memory:41204 kb ****************************************************************/