# [Problem]
# There are 2N cards with natural numbers written on them. These cards are arranged in a line from left to right.
# Each card has exactly one natural number between 1 and N.
# Let X_i (1 ≤ i ≤ 2N) be the natural number written on the i-th card from the left.
# For each k (1 ≤ k ≤ N), there are exactly two cards with the number k.
# That is, each natural number from 1 to N is written on exactly two cards.
# Jung-ol decided to call the number of cards placed between two cards with the natural number k as "Number of cards between k".
# For example, imagine the cards are placed as shown below.
# In the figure below, N=4 and X_1=1, X_2=2, X_3=2, X_4=4, X_5=3, X_6=1, X_7=3, X_8=4.
# Since there are cards with 2, 2, 4, 3 in order between the two cards with 1, the "Number of cards between 1" is 4.
# Since there are no cards between the two cards with 2, the "Number of cards between 2" is 0.
# Since there is only a card with 1 between the two cards with 3, the "Number of cards between 3" is 1.
# Since there are cards with 3, 1, 3 in order between the two cards with 4, the "Number of cards between 4" is 3.
# In the case above, the largest among the "Number of cards between k" is the "Number of cards between 1", and its value is 4.
# Jung-ol wants to find the largest value among the "Number of cards between k" for all natural numbers k from 1 to N.
# When the natural numbers written on the cards are given in the order they are arranged,
# write a program to find the largest value among all "Number of cards between k".
# [Constraints]
# All given numbers are integers.
# 1 ≤ N ≤ 2,000
# For each i (1 ≤ i ≤ 2N), 1 ≤ X_i ≤ N
# For each k (1 ≤ k ≤ N), there are exactly two cards with the number k.
# That is, k appears exactly twice among X_1, X_2, ..., X_{2N}.
# [Input Example]
# 4
# 1 2 2 4 3 1 3 4
#
# [Output Example]
# 4
To embed this project on your website, copy the following code and paste it into your website's HTML: