We prove that the Mahonian-Stirling pairs of permutation statistics (\sor,
\cyc) and (\inv, \mathrm{rlmin}) are equidistributed on the set of
permutations that correspond to arrangements of n non-atacking rooks on a
Ferrers board with n rows and n columns. The proofs are combinatorial and
use bijections between matchings and Dyck paths and a new statistic, sorting
index for matchings, that we define. We also prove a refinement of this
equidistribution result which describes the minimal elements in the permutation
cycles and the right-to-left minimum letters. Moreover, we define a sorting
index for bicolored matchings and use it to show analogous equidistribution
results for restricted permutations of type Bn and Dn.Comment: 23 page