A1429.[COCI-2010_2011-contest5]#1 BRODOVI

普及/提高-

COCI

通过率:0%

时间限制:1.00s

内存限制:128MB

题目描述

Mirko lives in a small town with a harbour: once in a blue moon a ship passes by. However, to this day Mirko remembers the day when all the ships who had ever visited the harbour showed up. He denoted this day by index
1.
Many days have passed since, but Mirko noted each day when at least one ship visited the harbour, naming these days entertaining.
Additionally, Mirko has noticed that each ship visits the harbour periodically, at regular intervals. For instance, an interval of length 3 implies that some ship visited the harbour on days 1, 4, 7, 10 etc.
Given Mirko’s list of entertaining days (including today which is considered to be an entertaining day as well), compute the minimum possible number of ships visiting his harbour.
Notes: All entertaining days appear on Mirko’s list. It is guaranteed that the given data is consistent - in other words, a solution will always exist.

输入格式

The first line of input contains an integer N (2 ≤ N ≤ 5000), the number of entertaining days.
The following N lines contain indices of entertaining days, one per line, in ascending order. The first and the last indices, representing the day from which Mirko started monitoring harbour traffic and today, respectively, will always appear on the list. The first index will always be 1, and the last one (index of today) will be less than 10^
9.

输出格式

The first and only line of output must contain the required minimum number of ships.

输入输出样例

  • 输入#1

    3 
    1 
    3 
    4 

    输出#1

    2
  • 输入#2

    5 
    1 
    7 
    10 
    13 
    19 

    输出#2

    2
  • 输入#3

    3 
    1 
    500000000 
    999999999 

    输出#3

    1

说明/提示

In test cases worth 70% of total points, day indices will be less than 5 000 000.

首页