Finding and Counting Permutations via CSPs