Update countPairsWithADiff