Ashu and Shanu are best buddies. One day Shanu gives Ashu a problem to test his intelligence.He gives him an array of N natural numbers and asks him to solve the following queries:-

Query 0:- modify the element present at index i to x.
Query 1:- count the number of even numbers in range l to r inclusive.
Query 2:- count the number of odd numbers in range l to r inclusive.    

input:
First line of the input contains the number N. Next line contains N natural numbers. 
Next line contains an integer Q followed by Q queries.
0 x y - modify the number at index x to y.  
1 x y - count the number of even numbers in range l to r inclusive.
2 x y - count the number of odd numbers in range l to r inclusive.  

Constraints:
1 ≤ N,Q ≤ 10^5
1 ≤ l ≤ r ≤ N  
0 ≤ Ai ≤ 10^9
1 ≤ x ≤ N
0 ≤ y ≤ 10^9

Note:- indexing starts from 1.

SAMPLE INPUT
6
1 2 3 4 5 6
4
1 2 5
2 1 4
0 5 4
1 1 6

SAMPLE OUTPUT
2
2
4
def build():
	for i in xrange(N-1,0,-1):
		tree[i] = tree[i<<1]+tree[i<<1|1]

def modify(position,value):
	position += N
	tree[position] = value%2
	while position > 1:
		tree[position>>1] = tree[position]+tree[position^1]
		position >>= 1

def query(l,r):
	ans,l,r = 0,l+N,r+N
	while l < r:
		if l&1:
			ans = ans+tree[l]
			l += 1
		if r&1:
			ans = ans+tree[r-1]
			r -= 1
		l, r = l>>1, r>>1
	return ans

N = input()
tree = [0]*(2*N)
tree[N:] = map(int,raw_input().split())
tree = [i%2 for i in tree]
build()
for i in range(input()):
	choice,a,b = map(int,raw_input().split())
	if choice == 0:  		modify(a-1,b)
	elif choice == 1:       print b-a-query(a-1,b)+1
	elif choice == 2:		print query(a-1,b)