import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { static long maximumPeople(long[] p, long[] x, long[] y, long[] r) { Map c_c = new HashMap<>(); for (int i = 0; i <= y.length; i++){ c_c.put(i, new Integer[]{y[i]-r[i],y[i]+r[i]}); } Map ci_c = new HashMap<>(); for (int i = 0; i <= x.length; i++){ ci_c.put(i,0); for (int j = 0; j <= y.length; j++){ Integer[] ranges = c_c.get(j); if (x[i] >= ranges[0] || x[i] <= ranges[1]) { int oldNumOfClouds = ci_c.get(i); oldNumOfClouds += 1; ci_c.put(oldNumOfClouds); } } } Map n_ci_c = ci_c.entrySet().stream().filter((city,nClouds) -> if (nClouds > 1) return false; else return true).collect(Collectors.toMap()); int max_pop = n_ci_c.values().stream().max(); Map n_n_ci_c = ci_c.entrySet().stream().filter((city,nClouds) -> if (nClouds >= 1) return false; else return true).collect(Collectors.toMap()); int zerocloud_sum = n_n_ci_c.values().stream().mapToInt(i -> i).sum(); return max_pop + zerocloud_sum; } public static void main(String[] args) { Scanner in = new Scanner(System.in); int n = in.nextInt(); long[] p = new long[n]; for(int p_i = 0; p_i < n; p_i++){ p[p_i] = in.nextLong(); } long[] x = new long[n]; for(int x_i = 0; x_i < n; x_i++){ x[x_i] = in.nextLong(); } int m = in.nextInt(); long[] y = new long[m]; for(int y_i = 0; y_i < m; y_i++){ y[y_i] = in.nextLong(); } long[] r = new long[m]; for(int r_i = 0; r_i < m; r_i++){ r[r_i] = in.nextLong(); } long result = maximumPeople(p, x, y, r); System.out.println(result); in.close(); } }