Calculate number of basepairs only once