Distinct Subarray GCDs

No attempts yetTime limit5sMemory limit256 MB

Problem

For a sequence AA of length nn, define f(lo,hi)f(lo, hi) as the GCD of AloA_{lo} through AhiA_{hi} (indices, not values). Count how many distinct values f(lo,hi)f(lo, hi) can take.

Input

Multiple test cases. Each starts with n$$(1 \le n \le 100000), then nn lines each with an element a$$(1 \le a \le 100). Input ends when n=0n = 0.

Output

For each test case, print the number of distinct GCD values on one line.