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

You are given *n* queries in the form "*x*<sub class="lower-index">*i*</sub> *y*<sub class="lower-index">*i*</sub>". For each query Petya should count how many divisors of number *x*<sub class="lower-index">*i*</sub> divide none of the numbers *x*<sub class="lower-index">*i* - *y*<sub class="lower-index">*i*</sub></sub>, *x*<sub class="lower-index">*i* - *y*<sub class="lower-index">*i*</sub> + 1</sub>, ..., *x*<sub class="lower-index">*i* - 1</sub>. Help him.
The first line contains an integer *n* (1 ≤ *n* ≤ 10<sup class="upper-index">5</sup>). Each of the following *n* lines contain two space-separated integers *x*<sub class="lower-index">*i*</sub> and *y*<sub class="lower-index">*i*</sub> (1 ≤ *x*<sub class="lower-index">*i*</sub> ≤ 10<sup class="upper-index">5</sup>, 0 ≤ *y*<sub class="lower-index">*i*</sub> ≤ *i* - 1, where *i* is the query's ordinal number; the numeration starts with 1). 

If *y*<sub class="lower-index">*i*</sub> = 0 for the query, then the answer to the query will be the number of divisors of the number *x*<sub class="lower-index">*i*</sub>. In this case you do not need to take the previous numbers *x* into consideration.
6
4 0
3 1
5 2
6 2
18 4
10000 3
3
1
1
2
2
22
5
10 0
10 0
10 0
10 0
10 0
4
4
4
4
4
12
41684 0
95210 1
60053 1
32438 3
97956 1
21785 2
14594 6
17170 4
93937 6
70764 5
13695 4
14552 6
12
6
7
9
22
3
2
13
1
6
13
11
10
54972 0
48015 1
7114 1
68273 2
53650 4
1716 1
16165 2
96062 5
57750 1
21071 5
24
21
3
3
21
22
6
6
62
3
20
68260 0
819 1
54174 1
20460 1
25696 2
81647 4
17736 4
91307 5
5210 4
87730 2
4653 8
11044 6
15776 4
17068 7
73738 7
36004 12
83183 7
75700 12
84270 14
16120 5
12
11
6
44
18
1
9
7
6
12
8
8
21
3
14
3
3
13
18
26
17
81548 0
69975 1
1234 0
72647 0
81389 4
77930 1
19308 0
86551 6
69023 8
38037 1
133 9
59290 8
1106 11
95012 10
57693 11
8467 6
93732 13
24
17
4
2
11
7
12
3
3
7
2
27
4
3
2
1
18
15
94836 0
22780 1
48294 0
24834 3
37083 2
57862 0
37231 1
81795 7
32835 2
4696 8
95612 0
7536 6
70084 5
72956 10
41647 7
24
21
12
4
6
8
3
27
12
5
24
15
8
21
1
12
91771 0
75584 1
95355 1
60669 1
92776 0
37793 3
38802 4
60688 0
80296 5
55003 8
91092 3
55782 8
2
13
23
17
8
2
13
10
4
2
9
10
11
5059 0
28388 1
42415 2
12856 0
48470 3
34076 2
40374 6
55932 1
44108 2
5310 5
86571 4
2
11
7
8
13
9
10
20
3
12
3
10
18347 0
81193 1
89475 2
65043 3
4164 0
14007 5
41945 0
51177 1
91569 5
71969 4
4
4
11
18
12
13
4
7
6
3
import sys
import collections as cc
input=sys.stdin.buffer.readline
I=lambda:list(map(int,input().split()))
prev=cc.defaultdict(int)
for tc in range(int(input())):
	x,y=I()
	div=set()
	for i in range(1,int(x**0.5)+1):
		if x%i==0:
			div.add(i)
			div.add(x//i)
	ans=0
	now=tc+1
	for i in div:
		if now-prev[i]>y:
			ans+=1
		prev[i]=now
	print(ans)
