# How to calculate a subgroup of some permutation?

I think is easier to explain it with a specific problem (but would be nice a generic answer):

We have 2 options, $$A$$ and $$B$$, counting permutations of $$N$$ items is easy, but how to calculate the subgroup where we have two $$A$$'s?
Example with $$N = 3$$:
$$AAA$$
$$AAB$$
$$ABA$$
$$BAA$$
$$ABB$$
$$BBA$$
$$BAB$$
$$BBB$$

To get the $$8$$ options is just $$2^3$$, but what is the formula to get "$$3$$" (permutation with 2 $$A$$)?

I might be oversimplifying this, but if order does not matter, then it's simply a question of how many ways can you place two A's in a list of three, which is $${3 \choose 2} = 3.$$ In general, for N objects with k number of A's it'd be $${N \choose k} = \frac{N!}{k!(N-k)!}$$.