It's always the number in digit not written from, code looks good like this (did not test yet).