omogen

Time limit: 1s Memory limit: 128MB Input: Output:

Task

A sequence (i,j)(i, j) with elements ai,ai+1,,aja_i, a_{i+1}, \dots, a_j is homogeneous if, for any two chosen positions xx and yy with xyx \neq y, the elements axa_x and aya_y are coprime.

You are given a sequence of length nn with nonzero positive integers. Determine the number of its homogeneous subsequences.

Input data

The first line will contain the number nn, representing the length of the sequence.
The second line will contain the nn values of the sequence aa, separated by spaces.

Output data

The first line of the output file will contain the number of homogeneous subsequences of the sequence.

Constraints and clarifications

  • 1N10000001 \leq N \leq 1000000.
  • 1ai1071 \leq a_i \leq 10^7, for ii [1,n]\in {[} 1, n {]}.
# Points Restrictions
1 18 1N2 0001 \leq N \leq 2 \ 000
2 43 1N200 0001 \leq N \leq 200 \ 000, 1ai2 000 0001 \leq a_i \leq 2 \ 000 \ 000
3 39 No additional restrictions.

Example

stdin

8
7 2 4 2 1 5 1 1

stdout

19

Explanation

For example, one of the 1919 homogeneous sequences is [2,1,5][2, 1, 5] because gcd(2,1)=1gcd(2, 1) = 1, gcd(2,5)=1gcd(2, 5) = 1, and gcd(1,5)=1gcd(1, 5) = 1.

On the other hand, the sequence [4,2,1][4, 2, 1] is not homogeneous because gcd(4,2)=2gcd(4, 2) = 2.

Log in or sign up to be able to send submissions!