#include <bits/stdc++.h>
using namespace std;
const long long MAX = 2e9, N = 1e6 + 10, MOD = 998244353, base = 1 << 18;
long long n, y, m;
long long A[N], B[N];
map<long long, long long> mapa;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cerr.tie(0);
  cin >> n >> y;
  for (long long i = ((0)); i <= ((n)-1); i++) cin >> A[i];
  cin >> m >> y;
  for (long long i = ((0)); i <= ((m)-1); i++) cin >> B[i];
  long long pot = 1 << 30;
  long long res = 0;
  while (pot /= 2) {
    mapa.clear();
    long long maxi = 0;
    for (long long i = ((0)); i <= ((n)-1); i++) {
      mapa[A[i] % (2 * pot)]++;
      maxi = max(maxi, mapa[A[i] % (2 * pot)]);
    }
    for (long long i = ((0)); i <= ((m)-1); i++) {
      mapa[(B[i] + pot) % (2 * pot)]++;
      maxi = max(maxi, mapa[(B[i] + pot) % (2 * pot)]);
    }
    res = max(res, maxi);
  }
  mapa.clear();
  for (long long i = ((0)); i <= ((n)-1); i++) mapa[A[i]]++;
  for (long long i = ((0)); i <= ((m)-1); i++) {
    mapa[B[i]]++;
    res = max(res, mapa[B[i]]);
  }
  cout << res;
}
