first attempt to solve how many matrices