count reversed pairs in array