




"""simple docstring"""
from __future__ import annotations

from collections import Counter

def 				lowercase      (_lowerCAmelCase		):
						__lowerCAmelCase        =       [True] * n
						__lowerCAmelCase        =       False
						__lowerCAmelCase        =       False
						__lowerCAmelCase        =       True

						for i in range(3				,  int(n**0.5 + 1		)				,  2		):
												__lowerCAmelCase        =       i * 2
												while index < n:
																		__lowerCAmelCase        =       False
																		__lowerCAmelCase        =       index + i

						__lowerCAmelCase        =       [2]

						for i in range(3				,  _lowerCAmelCase				,  2		):
												if is_prime[i]:
																		primes.append(_lowerCAmelCase		)

						return primes

def 				lowercase      (_lowerCAmelCase		):
						__lowerCAmelCase        =       str(_lowerCAmelCase		)
						__lowerCAmelCase        =       []
						__lowerCAmelCase        =       ["""0""", """1""", """2""", """3""", """4""", """5""", """6""", """7""", """8""", """9"""]

						for duplicate in Counter(_lowerCAmelCase		) - Counter(set(_lowerCAmelCase		)		):
												__lowerCAmelCase        =       [int(number_str.replace(_lowerCAmelCase				,  _lowerCAmelCase		)		) for digit in digits]
												replacements.append(_lowerCAmelCase		)

						return replacements

def 				lowercase      (_lowerCAmelCase = 8		):
						__lowerCAmelCase        =       set()

						# Filter primes with less than 3 replaceable digits
						__lowerCAmelCase        =       {
						    x for x in set(prime_sieve(100_0000		)		) if len(str(_lowerCAmelCase		)		) - len(set(str(_lowerCAmelCase		)		)		) >= 3
						}

						for prime in primes:
												if prime in numbers_checked:
																		continue

												__lowerCAmelCase        =       digit_replacements(_lowerCAmelCase		)

												for family in replacements:
																		numbers_checked.update(_lowerCAmelCase		)
																		__lowerCAmelCase        =       primes.intersection(_lowerCAmelCase		)

																		if len(_lowerCAmelCase		) != family_length:
																								continue

																		return min(_lowerCAmelCase		)

						return -1


if __name__ == "__main__":
			print(solution())


"""simple docstring"""
from __future__ import annotations
class      lowerCAmelCase_						:



							'''simple docstring'''





							def __init__(				self  ,							snake_case_							)   ->       None:
													__lowerCAmelCase        =       data
													__lowerCAmelCase        =       None
class      lowerCAmelCase_						:



							'''simple docstring'''





							def __init__(				self							)   ->       List[str]:
													__lowerCAmelCase        =       None




							def  A__		(				self  ,							snake_case_							)   ->       int:
													__lowerCAmelCase        =       Node(snake_case_							)
													__lowerCAmelCase        =       self.head
													__lowerCAmelCase        =       new_node
													return self.head.data




							def  A__		(				self							)   ->       int | None:
													__lowerCAmelCase        =       self.head
													__lowerCAmelCase        =       self.head
													if self.head:
																			while fast_pointer and fast_pointer.next:
																									__lowerCAmelCase        =       fast_pointer.next.next
																									__lowerCAmelCase        =       slow_pointer.next
																			return slow_pointer.data
													else:
																			print("""No element found."""							)
																			return None


if __name__ == "__main__":
			SCREAMING_SNAKE_CASE_			      =					LinkedList()
			for _ in range(int(input().strip())):
						SCREAMING_SNAKE_CASE_			      =					int(input().strip())
						link.push(data)
			print(link.middle_element())
