How many languages before the Tower of Babel?

Genesis 10:5, 10:20, 10:31 suggest that there were many language. However, Genesis 11:1 states that there were only one language, which seems contradictory.

This apparent inconsistency is resolved when we understand that Genesis 10 and 11 are not arranged in strict chronological order.

Genesis 10 records the outcome (the division of nations and languages), while Genesis 11:1-9 explains the cause (the explanation of how and why the people were scattered and how multiple languages came into existence). The author first presents the result, then circles back to recount the event that led to it.