Store the value in struct Array
for i in range ( 1 , n + 1 ) : NEW_LINE INDENT v [ i - 1 ] = v [ i - 1 ] - 1 NEW_LINE x = v [ i - 1 ] NEW_LINE where [ x ] = i - 1 NEW_LINE arr [ i - 1 ] . val = x NEW_LINE arr [ i - 1 ] . index = i - 1 NEW_LINE DEDENT