double count algorithm first implemented