Counting nonsingular matrices with primitive row vectors