I encountered a counting problem, which seems pretty easy but it is actually hard when I tried it...
There are four baskets numbered from 1 to 4 and four balls numbered from 1 to 4. Each basket is allowed to have at most two balls. In how many ways can the balls be placed in the baskets such that no ball has the same number as the basket it is in?
I figured that without any restriction, there are total of 204 ways. I don't know how to continue from that. Any help will be greatly appreciated!