How to find number of solutions in a linear equation