Finding the number of solutions in a system of linear equations