Package for this problem was not updated by the problem writer or Codeforces administration after we’ve upgraded the judging servers. To adjust the time limit constraint, solution execution time will be multiplied by 2. For example, if your solution works for 400 ms on judging servers, then value 800 ms will be displayed and used to determine the verdict.

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

B. Petya and Divisors

time limit per test

5 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputLittle Petya loves looking for numbers' divisors. One day Petya came across the following problem:

You are given *n* queries in the form "*x*_{i} *y*_{i}". For each query Petya should count how many divisors of number *x*_{i} divide none of the numbers *x*_{i - yi}, *x*_{i - yi + 1}, ..., *x*_{i - 1}. Help him.

Input

The first line contains an integer *n* (1 ≤ *n* ≤ 10^{5}). Each of the following *n* lines contain two space-separated integers *x*_{i} and *y*_{i} (1 ≤ *x*_{i} ≤ 10^{5}, 0 ≤ *y*_{i} ≤ *i* - 1, where *i* is the query's ordinal number; the numeration starts with 1).

If *y*_{i} = 0 for the query, then the answer to the query will be the number of divisors of the number *x*_{i}. In this case you do not need to take the previous numbers *x* into consideration.

Output

For each query print the answer on a single line: the number of positive integers *k* such that

Examples

Input

6

4 0

3 1

5 2

6 2

18 4

10000 3

Output

3

1

1

2

2

22

Note

Let's write out the divisors that give answers for the first 5 queries:

1) 1, 2, 4

2) 3

3) 5

4) 2, 6

5) 9, 18

Codeforces (c) Copyright 2010-2020 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Jan/20/2020 02:21:06 (h3).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|