C # program to implement the above approach
using System ; using System . Collections ; using System . Collections . Generic ; class GFG { static int find_permutations ( ArrayList arr ) { int cnt = 0 ; int max_ind = - 1 , min_ind = 10000000 ; int n = arr . Count ; Dictionary < int , int > index_of = new Dictionary < int , int > ( ) ;