Implementation of the algorithm to calculate permutation's index in lexical order
Main program mechanism