1 #include<bits/stdc++.h>
2 #define lowbit(a) ((a)&(-(a)))
3 #define clr(a,x) memset(a,x,sizeof(a))
4 #define rep(i,l,r) for(int i=l;i<(r);i++)
5 typedef long long ll;
6 using namespace std;
7 int read()
8 {
9 char c=getchar();
10 int ans=0,f=1;
11 while(!isdigit(c)){
12 if(c==‘-‘) f=-1;
13 c=getchar();
14 }
15 while(isdigit(c)){
16 ans=ans*10+c-‘0‘;
17 c=getchar();
18 }
19 return ans*f;
20 }
21 struct edge{
22 int u,v;
23 double d;
24 inline bool operator<(const edge&A)const{
25 return d<A.d;
26 }
27 };
28 const int maxn=1009,inf=0x7fffffff;
29 int n,m,cnt=0,ans=0,x[maxn],y[maxn],a[maxn],f[maxn];
30 double mn=-1e30;
31 edge e[maxn*maxn];
32 void addedge(int u,int v,double d){
33 edge ed;
34 ed.u=u;ed.v=v;ed.d=d;
35 e[cnt++]=ed;
36 }
37 int find(int x){
38 return f[x]==x?f[x]:f[x]=find(f[x]);
39 }
40 int main()
41 {
42 m=read();
43 rep(i,0,m) a[i]=read();
44 n=read();
45 rep(i,0,n) x[i]=read(),y[i]=read(),f[i]=i;
46 rep(i,0,n-1){
47 rep(j,i+1,n)
48 addedge(i,j,sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j])));
49 }
50 sort(e,e+cnt);
51 rep(i,0,cnt){
52 int s=find(e[i].u),t=find(e[i].v);
53 if(s!=t){
54 f[s]=t;
55 mn=max(mn,e[i].d);
56 }
57 }
58 rep(i,0,m) if(a[i]>=mn) ans++;
59 printf("%d\n",ans);
60 return 0;
61 }