#include <iostream>
#include <fstream>
#include <cstdlib>
using namespace std;
int main()
{   ifstream fin("pijaca.in");
    ofstream fout("pijaca.out");
    int n;
    int x[200];
    fin>>n;
    for(int i=0;i<n;i++)
    fin>>x[i];
    int q;
    fin>>q;
    int k,l,r,a,b;
    int j1,j2;
    int s=0;
    for(int i=0;i<q;i++)
    {
        fin>>k;
        if(k==1){   s=0;
                   fin>>l;
                   fin>>r;
                   fin>>a;
                   fin>>b;
                   for(int i1=l-1;i1<r;i1++)
                   {
                   if((x[i1]>=a)&&(x[i1]<=b)) s++;
                   }
                   fout<<s<<endl;
                }
        else {
                fin>>j1>>j2;
                x[j1-1]=j2;
             }
    }
    fin.close();
    fout.close();
    return 0;
}
