Computing the growth of the number of overlap-free words with spectra of matrices