When comparing two independent population means, how do I find the degree of freedoms?

df = n1 + n2 - 2

Note: n1 and n2 are the sample sizes of the two groups.