implemented pairs counting, which is necessary for external validation measures