logo AlgoBeat OnlineJudge
登录 注册

#215653. [ICPC 2020 Jakarta R] Moon and Sun

内存限制:256 MiB 时间限制:1000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

Let be a non-empty sequence of integers and be a positive integer. The functions and are defined as follows.

For example,

  • .
  • .
  • .

Observe that is always a sequence with exactly one element.

You are given a sequence of integers . An index is hot if and only if there exists a sequence satisfying the following conditions:

  • and is an integer between and , inclusive;
  • for all ;
  • The only element in is a multiple of .

Your task in this problem is to count the number of hot indices in a given .

For example, there are hot indices in , which are .

  • , → →
  • , → →
  • , → →

Note that both and are multiples of . On the other hand, the index is not hot as there does not exist an integer between and , inclusive, such that the only element in is a multiple of . The index is also not hot for a similar reason.

输入格式

Input begins with a line containing an integer: () representing the number of integers in . The next line contains integers: () representing the sequence of integers.

输出格式

Output in a line an integer representing the number of hot indices in the given .

样例

样例输入 1

5
4 1 0 7 2

样例输出 1

3

样例输入 2

4
10 20 30 -40

样例输出 2

4

样例输入 3

2
100 100

样例输出 3

0

数据范围与提示

Explanation for the sample input/output #1

This is the example from the problem description.

Explanation for the sample input/output #2

  • , → →
  • , → →
  • , → →
  • , → →