I have a problem in combinatorics.

How many passwords can we create such as:

- Each password has length $n$ when $nge3$.
- Each password must contain
**at least**one capital letter (there are 26 letters in English), and**at least**one small letter, and**at least one digit**(there are 10 possible digits)

I tried solving this problem like this:

There are $62^{n}$ possible passwords without any restrictions

There are $2*26^{n}$ passwords with only capital letters **or** small letters.

There are $10^{n}$ passwords with only digits.

There are $52^{n}$ passwords with only capital letters **and** small letters.

There are $36^{n}-10^{n}-26^{n}$ passwords with only **capital** letters **and** digits.

There are $36^{n}-10^{n}-26^{n}$ passwords with only **small** letters **and** digits.

So to get the “right answer” I subtracted all of them from $62^{n}$ and got $62^{n}-52^{n}-2*36^{n}+10^{n}$

Is this the right method/answer? or did I miss something silly?

I am new to combinatorics and I want to make sure, I am on the right track.

Thanks in advance guys!