Counting arrangements or permutations