CF926B.Add Points

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

There are nn points on a straight line, and the ii -th point among them is located at xix_{i} . All these coordinates are distinct.

Determine the number mm — the smallest number of points you should add on the line to make the distances between all neighboring points equal.

输入格式

The first line contains a single integer nn ( 3<=n<=1000003<=n<=100000 ) — the number of points.

The second line contains a sequence of integers x1,x2,...,xnx_{1},x_{2},...,x_{n} ( 109<=xi<=109-10^{9}<=x_{i}<=10^{9} ) — the coordinates of the points. All these coordinates are distinct. The points can be given in an arbitrary order.

输出格式

Print a single integer mm — the smallest number of points you should add on the line to make the distances between all neighboring points equal.

输入输出样例

  • 输入#1

    3
    -5 10 5
    

    输出#1

    1
    
  • 输入#2

    6
    100 200 400 300 600 500
    

    输出#2

    0
    
  • 输入#3

    4
    10 9 0 -1
    

    输出#3

    8
    

说明/提示

In the first example you can add one point with coordinate 00 .

In the second example the distances between all neighboring points are already equal, so you shouldn't add anything.

首页