import java.util.Scanner;

// Node class to define the structure of each node in the linked list
class Node {
    int data;
    Node next;

    Node(int data) {
        this.data = data;
        this.next = null;
    }
}

// LinkedList class to manage the linked list operations
class LinkedList {
    Node head;

    // Method to add a new node to the end of the linked list
    public void add(int data) {
        Node newNode = new Node(data);
        if (head == null) {
            head = newNode;
        } else {
            Node temp = head;
            while (temp.next != null) {
                temp = temp.next;
            }
            temp.next = newNode;
        }
    }

    // Method to find the middle element of the linked list
    public int findMiddle() {
        if (head == null) {
            return -1; // Return -1 if the list is empty
        }

        Node slow = head;
        Node fast = head;

        while (fast != null && fast.next != null) {
            slow = slow.next;
            fast = fast.next.next;
        }

        return slow.data;
    }
}

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        LinkedList list = new LinkedList();

        // Read input from the user
        int n = scanner.nextInt(); // Get the number of elements
if(n<=0){
System.out.println("Invalid input");
break;
}
        for (int i = 0; i < n; i++) {
            int data = scanner.nextInt();
            list.add(data);
        }

        // Find and display the middle element of the linked list
        System.out.println(list.findMiddle());

        scanner.close();
    }
}
