from itertools import combinations N = int(input()) K = list(map(int, input().split())) DP = [-1]*(1< a and b > c) for i in range(1<> j) & 1 == 1: nums.append(j) if len(nums) < 3: continue for a, b, c in combinations(nums, 3): if kadomatsu_check(K[a], K[b], K[c]): # a, b, c を取り除いた集合に到達できる dst = i ^ (1<