Increment count only if the current element has not been visited yet ( if is visited , means it has already been placed at its correct position )
if ( visited [ arr [ j ] ] == False ) : NEW_LINE INDENT count += 1 NEW_LINE DEDENT