Added utility for counting swaps.