#include <stdio.h>
int main()
{
int T,F;
int i,m,p[100],a,b,count;
// freopen("in.txt","r",stdin);
// freopen("out.txt","w",stdout);
scanf("%d",&T);
while(T--)
{
scanf("%d",&m);
for(i=1;i<=m;i++)
{
scanf("%d",&p[i]);
}
scanf("%d",&F);
while(F--)
{
count=0;
scanf("%d%d",&a,&b);
for(i=1;i<=m;i++)
{
if(a<=p[i]&&b>=p[i])
count++;
}
printf("%d\n",count);
}
printf("\n");
}
return 0;
}
啊啊啊啊啊