You are given a sequence a consisting of n integers. Find the maximum possible value of (integer remainder of ai divided by aj), where 1 \le i,j \le n and ai \ge aj.
The first line contains integer n- the length of the sequence (1 \le n \le 2 \cdot 105).
The second line contains n space-separated integers ai (1 \le ai \le 106).
Print the answer to the problem.