Counting Matrices