LogiQuest

364. Middle of a Linked List

EasyTwo Pointers

Print the value of the middle node. With two middle nodes, print the second one.

Input format

Line 1: n Line 2: n values

Output format

The middle value.

Example 1

Input

5
1 2 3 4 5

Output

3

Example 2

Input

6
1 2 3 4 5 6

Output

4

Constraints

1 ≤ n ≤ 10⁵

Read input from standard input and print the answer to standard output. Your code is judged against 4 test cases, most of them hidden.

Loading the MyLoginn IDE…