시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
10 초 512 MB 148 61 36 33.962%

문제

In 1978 AD the great Sir Isaac Newton, whilst proving that P is a strict superset of N P, defined the Beta Alpha Pi Zeta function f as follows over any sequence of positive integers a1, . . . , an. Given integers 1 ≤ i ≤ j ≤ n, we define f(i, j) as gcd(ai, ai+1, . . . , aj−1, aj).

About a century later Lothar Collatz applied this function to the sequence 1, 1, 1, . . . , 1, and observed that f always equalled 1. Based on this, he conjectured that f is always a constant function, no matter what the sequence ai is. This conjecture, now widely known as the Collatz Conjecture, is one of the major open problems in botanical studies. (The Strong Collatz Conjecture claims that however many values f takes on, the real part is always 1/2.)

You, a budding young cultural anthropologist, have decided to disprove this conjecture. Given a sequence ai , calculate how many different values f takes on.

입력

The input consists of two lines.

• • A single integer 1 ≤ n ≤ 5 · 105, the length of the sequence.
• The sequence a1, a2, . . . , an. It is given that 1 ≤ ai ≤ 1018.

출력

Output a single line containing a single integer, the number of distinct values f takes on over the given sequence.

예제 입력 1

4
9 6 2 4


예제 출력 1

6


예제 입력 2

4
9 6 3 4


예제 출력 2

5


출처

• 데이터를 추가한 사람: doju