Problem: 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

Solution (in PYTHON):

Solution:
def build(node,start,end):
    global tree
    global ar
    if start==end:
        #print start,end,node
        tree[node]=(ar[start]&1)
        return
    mid=(start+end)/2
    build(node*2+1,start,mid)
    build(node*2+2,mid+1,end)
    tree[node]=(tree[2*node+1]+tree[2*node+2])
    return
def count(node,start,end,l,r):
    global tree
    global ar
    if l<=start and r>=end:
        return tree[node]
    if r<start or l>end:
        return 0
    mid=(start+end)/2
    return count(2*node+1,start,mid,l,r)+count(2*node+2,mid+1,end,l,r)
def update(node,start,end,val,index):
    global tree
    global ar
    #print "tree in update =",tree
    if(start==end):
        #print start,end,node
        ar[index]=val
        tree[node]=(val&1)
        return
    mid=(start+end)/2
    if start<=index and index<=mid:
        update(2*node+1,start,mid,val,index)
    else:
        update(2*node+2,mid+1,end,val,index)
    tree[node]=tree[2*node+1]+tree[2*node+2]
    return
n=input()
ar=[int(i) for i in raw_input().split()]
tree=[0]*(10*n)
build(0,0,n-1)
q=input()
for i in range(0,q):
    #print tree
    m,a,b=(int(i) for i in raw_input().split())
    if m==0:
        update(0,0,n-1,b,a-1)
    elif m==1:
        print (b-a+1-count(0,0,n-1,a-1,b-1))
    else:
        print count(0,0,n-1,a-1,b-1)