For every element arr [ i ] , x is count of occurrence of arr [ i ] in different set such that index of arr [ i ] in those sets divides m completely .
x = 0 NEW_LINE for j in range ( 1 , m + 1 ) : NEW_LINE