






from __future__ import annotations

from typing import Generic, TypeVar

__UpperCAmelCase      =				TypeVar("T")
class 	a_(		lowercase__	):



     """simple docstring"""



     pass

class 	a_(		lowercase__	):



     """simple docstring"""



     pass

class 	a_(		Generic[T]	):



     """simple docstring"""



     def __init__(		self					:	Optional[int]  ,  lowerCAmelCase__					:	int = 1_0)							->	List[Any]:

      """simple docstring"""
      SCREAMING_SNAKE_CASE				    =		[]
      SCREAMING_SNAKE_CASE				    =		limit





     def __bool__(		self					:	Tuple)							->	bool:

      """simple docstring"""
      return bool(self.stack)





     def __str__(		self					:	str)							->	str:

      """simple docstring"""
      return str(self.stack)





     def     __UpperCamelCase						(		self					:	Tuple  ,  lowerCAmelCase__					:	T)							->	None:

      """simple docstring"""
      if len(self.stack) >= self.limit:
       raise StackOverflowError
      self.stack.append(lowerCAmelCase__)





     def     __UpperCamelCase						(		self					:	int)							->	T:

      """simple docstring"""
      if not self.stack:
       raise StackUnderflowError
      return self.stack.pop()





     def     __UpperCamelCase						(		self					:	Tuple)							->	T:

      """simple docstring"""
      if not self.stack:
       raise StackUnderflowError
      return self.stack[-1]





     def     __UpperCamelCase						(		self					:	Tuple)							->	bool:

      """simple docstring"""
      return not bool(self.stack)





     def     __UpperCamelCase						(		self					:	Optional[Any])							->	bool:

      """simple docstring"""
      return self.size() == self.limit





     def     __UpperCamelCase						(		self					:	Any)							->	int:

      """simple docstring"""
      return len(self.stack)





     def __contains__(		self					:	List[Any]  ,  lowerCAmelCase__					:	T)							->	bool:

      """simple docstring"""
      return item in self.stack





def 						A_					(						)				->None:







 """simple docstring"""

 SCREAMING_SNAKE_CASE				    =		Stack(1_0			)
 assert bool(lowercase_			) is False
 assert stack.is_empty() is True
 assert stack.is_full() is False
 assert str(lowercase_			) == "[]"

 try:
  SCREAMING_SNAKE_CASE				    =		stack.pop()
  raise AssertionError  # This should not happen
 except StackUnderflowError:
  assert True  # This should happen

 try:
  SCREAMING_SNAKE_CASE				    =		stack.peek()
  raise AssertionError  # This should not happen
 except StackUnderflowError:
  assert True  # This should happen

 for i in range(1_0			):
  assert stack.size() == i
  stack.push(lowercase_			)

 assert bool(lowercase_			)
 assert not stack.is_empty()
 assert stack.is_full()
 assert str(lowercase_			) == str(list(range(1_0			)			)			)
 assert stack.pop() == 9
 assert stack.peek() == 8

 stack.push(1_0_0			)
 assert str(lowercase_			) == str([0, 1, 2, 3, 4, 5, 6, 7, 8, 1_0_0]			)

 try:
  stack.push(2_0_0			)
  raise AssertionError  # This should not happen
 except StackOverflowError:
  assert True  # This should happen

 assert not stack.is_empty()
 assert stack.size() == 1_0

 assert 5 in stack
 assert 5_5 not in stack


if __name__ == "__main__":
      test_stack()










from __future__ import annotations

class   UpperCAmelCase    :






   def __init__(						self :							List[Any]    ,       UpperCamelCase_ :							int  )->      None:
     _lowercase:			Optional[Any]      =     data
     _lowercase:			Optional[int]      =     None

class   UpperCAmelCase    :






   def __init__(						self :							Optional[Any]  )->      Union[str, Any]:
     _lowercase:			List[str]      =     None






   def 			_a    (						self :							List[Any]    ,       UpperCamelCase_ :							int  )->      int:
     _lowercase:			Any      =     Node(UpperCamelCase_  )
     _lowercase:			List[Any]      =     self.head
     _lowercase:			List[str]      =     new_node
     return self.head.data






   def 			_a    (						self :							Tuple  )->      int | None:
     _lowercase:			List[str]      =     self.head
     _lowercase:			str      =     self.head
     if self.head:
       while fast_pointer and fast_pointer.next:
         _lowercase:			Optional[int]      =     fast_pointer.next.next
         _lowercase:			Tuple      =     slow_pointer.next
       return slow_pointer.data
     else:
       print('No element found.'  )
       return None


if __name__ == "__main__":
   UpperCAmelCase__    :							Union[str, Any]       		=     LinkedList()
   for _ in range(int(input().strip())):
      UpperCAmelCase__    :							List[Any]       		=     int(input().strip())
      link.push(data)
   print(link.middle_element())
