public static boolean isValid(List<Integer> index, int n) {
		int len = index.size();
		for (int i = 0; i < index.size(); i++) {
			if (index.get(i) == n || Math.abs(n - index.get(i)) == Math.abs(len - i)) return false;
		}
		return true;
	}