#include<algorithm> #include<iostream> #include<cstdio> using namespace std; inline int read() { int x = 0, f = 1; char ch = getchar(); while (ch < '0' || ch > '9') { if (ch == '-')f = -1; ch = getchar(); } while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); } return x*f; } struct edge { int x, y, v; } e[500001]; int n, m, tot, cnt, mx, ans, fa[1001], a[501], x[1001], y[1001]; inline bool cmp(edge a, edge b) { return a.v < b.v; } inline int find(int x) { return x == fa[x] ? x : fa[x] = find(fa[x]); } int main() { m = read(); for (int i = 1; i <= m; i++) a[i] = read(); n = read(); for (int i = 1; i <= n; i++) { fa[i] = i; x[i] = read(); y[i] = read(); } for (int i = 1; i < n; i++) for (int j = i + 1; j <= n; j++) e[++cnt] = (edge){i, j, (x[i] - x[j])*(x[i] - x[j])+(y[i] - y[j])*(y[i] - y[j])}; sort(e + 1, e + cnt + 1, cmp); for (int i = 1; i <= cnt; i++) { int p = find(e[i].x), q = find(e[i].y); if (p != q) { fa[p] = q; tot++; if (tot == n - 1) { mx = e[i].v; break; } } } for (int i = 1; i <= m; i++) if (a[i] * a[i] >= mx) ans++; printf("%d", ans); return 0; }