P25297 [AtCoder] Time Gap
普及+
题目描述

Problem Description

In the CODE FESTIVAL of XXXX, there were $ N+1 $ participants from around the world, including Takahashi.

After investigating the time differences between Takahashi's city and the other $ N $ cities, it was found that the time difference with the $ i $th person's city is $ D_i $ hours. For two cities, if one city is at 0:00 while the other city is at $ d $:00, the time difference between these cities is considered to be $ min(d, 24-d) $. Here, the time notation used is the 24-hour format. This means, for example, at the moment when it is 0:00 in Takahashi's city, it could be either $ D_i $:00 or $ 24-D_i $:00 in the $ i $th person's city.

Next, Takahashi listed the time differences between every pair of the $ N+1 $ participants' cities and set the minimum of these time differences to $ s $.

Find the maximum possible value of $ s $.

Input Format

The input is given from the standard input in the following format:

$ N $ $ D_1 $ $ D_2 $ $ ... $ $ D_N $

Output Format

Output the maximum possible value of $ s $.

Sample Input and Output

Sample Input #1

3
7 12 8

Sample Output #1

4

Sample Input #2

2
11 11

Sample Output #2

2

Sample Input #3

1
0

Sample Output #3

0

Notes/Hints

Constraints

  • $1 \leq N \leq 50$
  • $0 \leq D_i \leq 12$
  • All inputs are integers.

Sample Explanation 1

For example, if it is 0:00 in Takahashi's city and the times in the other cities are 7:00, 12:00, and 16:00 respectively, the time difference between the cities of the 2nd and 3rd persons is 4 hours.

Sample Explanation 3

Note that Takahashi is also included in the participants.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
3 7 12 8
样例输出
4