calculating the number of basis functions