Internal grammar of numbers