# -*- coding: utf-8 -*- N = int(input()) A = list(map(int, input().split())) dp = [False] * 100000 def solution(i, m): if not dp[m]: if i