Counting arrangements with constraints