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