static void check_answer(int n) {
		boolean[] doors = new boolean[n + 1]; // false means closed door.
		for (int i = 1; i <= n; ++i) {
			int start = 0;
			while (start + i <= n) {
				start += i;
				doors[start] = doors[start] ? false : true;
			}
		}

		for (int i = 1; i <= n; ++i) {
			assert is_door_open(i) == doors[i];
		}
	}