counting solutions