get count of 1 between 1 and n