How many positive integers less than 10,000 have at most two different digits?

Note: Due to feedback, I'm going to alternate the highly technical puzzles and the quicker more accessible puzzles so that the content is spread a bit more evenly. Even if these kinds of puzzles aren't up your alley, give them a shot and see how you do! =)