logo AlgoBeat OnlineJudge
登录 注册

#216239. [ICPC 2014 NAIPC] GCDs

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

题目描述

Given a sequence of numbers, define , , as the Greatest Common Divisor of all the numbers through , inclusive. Note that and are indices, not members of the list. Given an array, considering all possible values of and , how many unique values of will there be?

输入格式

There will be several test cases in the input. Each test case will begin with a line with a single integer () representing the length of the sequence. The next lines will each have an integer (). These are the numbers in the sequence, in sequence order. The input will end with a line with a single 0.

输出格式

For each test case, output a single integer denoting the number of unique values can have for the input sequence. Do not output any spaces, and do not print any blank lines between answers.

样例

样例输入 1

2
4
6
3
3
6
8
0

样例输出 1

3
5