PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN

#GL0000034. Bước nhảy lớn nhất để ghé thăm mọi thành phố (Skip)

HỌC THEO LỘ TRÌNH

Bài tập thuộc lộ trình

1 lộ trình

Bước nhảy lớn nhất để ghé thăm mọi thành phố (Skip)

Skip

Source: AtCoder

Version: Phuoc Hung OJ Extended

Problem Statement

There are NN cities at distinct integer coordinates xix_i on a line. You start at XX, which differs from all city coordinates. Choose a positive step length DD; every move changes your coordinate by exactly DD to the left or right. Find the greatest DD for which every city is reachable.

Input

The first line contains N,XN,X; the second has the NN city coordinates.

Output

Print the maximum DD.

Subtasks

  • Subtask 1 (20 points): 1≤N≤51 \le N \le 5; 1≤X,xi≤1001 \le X,x_i \le 100; All xix_i are pairwise distinct and differ from XX.
  • Subtask 2 (30 points): 1≤N≤10001 \le N \le 1000; 1≤X,xi≤1061 \le X,x_i \le 10^{6}; All xix_i are pairwise distinct and differ from XX.
  • Subtask 3 (50 points): 1≤N≤1051 \le N \le 10^{5}; 1≤X,xi≤1091 \le X,x_i \le 10^{9}; All xix_i are pairwise distinct and differ from XX.

Examples

Input

3 3
1 7 11

Output

2

Explanation

With D=2D=2, all three locations are reachable from X=3X=3. The step length must divide distances 2,4,82,4,8, whose GCD is 22.