public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder out = new StringBuilder();
		String line;
		while ((line = in.readLine()) != null) {
			int n = Integer.parseInt(line.trim());
			if (n == 0)
				break;
			while (true) {
				int[] c = readInts(in.readLine());
				if (c[0] == 0)
					break;
				Stack<Integer> s = new Stack<>();
				int index = 0;
				for (int i = 1; i <= n; i++) {
					s.push(i);
					while (index < n && !s.isEmpty() && c[index] == s.peek()) {
						s.pop();
						index++;
					}
				}
				if (index == n)
					out.append("Yes\n");
				else
					out.append("No\n");
			}
			out.append('\n');
		}
		System.out.print(out);
	}