def CountReordered(sequence_numbers):
  """Returns number of reordered indices.

  A reordered index is an index `i` for which sequence_numbers[i] >=
  sequence_numbers[i + 1]
  """
  return sum(1 for (s1, s2) in zip(sequence_numbers,
                                   sequence_numbers[1:]) if
             s1 >= s2)