The Ruthless Boss

Given n distinct deadlines, find the largest integer k so that scheduling all jobs, each taking exactly k hours back to back, meets every deadline.

Medium5GreedySortingBinary searchMathInterviewNo attempts yetTime limit2sMemory limit512 MB

Problem

zych runs Namgyu Company and is known for working the staff to the bone. Today zych is again planning how to squeeze more hours out of them.

The company has nn jobs, and every job has its own deadline. Missing a deadline costs a contract penalty, so all nn jobs have to be finished. Spending too little time on a job lowers the quality of the result, so zych wants the staff to spend as much time as possible on each one. Different durations confuse the staff, so every job takes exactly kk hours.

Work starts at time 00 and the jobs run one at a time, back to back with no idle gap. A job with deadline AiA_i must finish at a time no later than AiA_i. You choose the order of the jobs.

Given the nn deadlines, print the largest integer kk for which every job finishes by its deadline.

Input

The first line contains the number of jobs nn. (1n500001 \le n \le 50000)

The second line contains the deadlines A1,A2,,AnA_1, A_2, \dots, A_n, separated by spaces. (1Ai10000000001 \le A_i \le 1000000000) No two jobs share a deadline.

Output

Print the largest integer kk for which every job finishes by its deadline.