This sentence is grammatically incorrect.
The verb HABER is used in Spanish to mean TO HAVE. However, when it is used in past tense, it means USED TO/THERE WAS. When used with that meaning, the verb haber has only one form in the past, and that is HABIA (without -n in the end). So it only uses the singular form (without N). The sentence should be Había diez libros sobre la mesa.