#522
Unrated
Stone Game
시간 제한
2s
메모리 제한
1024MB
제출
0
정답
0
맞힌 사람
0
정답 비율
0.0%

문제

Bessie and Elsie are playing a game with NN (1N1051\le N\le 10^5) piles of stones, where the ii-th pile has aia_i stones for each 1iN1\le i\le N (1ai1061\le a_i\le 10^6). The two cows alternate turns, with Bessie going first.

First, Bessie chooses some positive integer s1s_1 and removes s1s_1 stones from some pile with at least s1s_1 stones. Then Elsie chooses some positive integer s2s_2 such that s1s_1 divides s2s_2 and removes s2s_2 stones from some pile with at least s2s_2 stones. Then Bessie chooses some positive integer s3s_3 such that s2s_2 divides s3s_3 and removes s3s_3 stones from some pile with at least s3s_3 stones and so on. In general, sis_i, the number of stones removed on turn ii, must divide si+1s_{i+1}.

The first cow who is unable to remove stones on her turn loses.

Compute the number of ways Bessie can remove stones on her first turn in order to guarantee a win (meaning that there exists a strategy such that Bessie wins regardless of what choices Elsie makes). Two ways of removing stones are considered to be different if they remove a different number of stones or they remove stones from different piles.

입력

The first line contains NN.

The second line contains NN space-separated integers a1,,aNa_1,\ldots,a_N.

출력

Print the number of ways Bessie can remove stones on her first turn in order to guarantee a win.

Note that the large size of integers involved in this problem may require the use of 64-bit integer data types (e.g., a "long long" in C/C++).

예제 입력 1

1
7

예제 출력 1

4

예제 입력 2

6
3 2 3 2 3 1

예제 출력 2

8

점수

Test cases 3-5 satisfy N=2N=2.Test cases 6-10 satisfy N,ai100N,a_i\le 100.Test cases 11-20 satisfy no additional constraints.

코드 제출

코드를 제출하려면 로그인이 필요합니다.

로그인
내 제출
제출 내역이 없습니다.
맞은 사람
아직 맞은 사람이 없습니다.
난이도 투표
Unrated0명 투표
로그인 후 AC 받으면 투표할 수 있습니다.
전체 제출
제출 내역이 없습니다.