If we draw the truth table with 3 variables, then 23 combinations are possible. The function needs to produce exactly 2 minterms, so $\binom{2^{3}}{2}$ functions ar possible.
Similarly, to have 7 minterms, $\binom{2^{3}}{7}$ functions are possible.
Using addition rule of counting, $\binom{2^{3}}{2} + \binom{2^{3}}{7}$ functions are possible.