I had a logical riddle on a programming interview test which was something like this:

> 
> In his garage a millionaire had cars, of which only 2 were not white, only 2 were not green and only 2 were not red. How many cars did the millionaire have in his garage?
> 
> 
> 

This seemed quite straightforward to me and I gave an answer, however I wasn't allowed to see my test afterwards and I cannot tell if the answer is correct.

I am curious to see if my answer was correct and also if there is a better mathematical derivation to the problem.