#!/usr/bin/python3 # 28-Z4-3: Množiny # Autor: Martin Šerý from bisect import bisect_left #binary_search nam vrati index x v poli a[lo:hi] nebo -1 pokud se tam x nevyskytuje def binary_search(a, x, lo=0, hi=None): hi = hi if hi is not None else len(a) pos = bisect_left(a,x,lo,hi) return (pos if pos != hi and a[pos] == x else -1) N = int(input()) cisla = list(map(int, input().strip().split())) cisla.sort() for x in cisla: if (x == 1 and binary_search(cisla, x**2, x) != -1 and binary_search(cisla, x**3, x) != -1): print(x) break