#include <bits/stdc++.h>
#pragma optimization_level 3
using namespace std;
int main() {
  long long n, y1;
  cin >> n >> y1;
  vector<long long> x1, x2;
  for (long long i = 0; i < n; i++) {
    long long aa;
    cin >> aa;
    x1.push_back(aa);
  }
  long long m, y2;
  cin >> m >> y2;
  for (long long i = 0; i < m; i++) {
    long long aa;
    cin >> aa;
    x2.push_back(aa);
  }
  long long ans = 0;
  for (long long po = 0; po < 33; po++) {
    long long delta = (1LL << po);
    delta *= 2LL;
    map<int, long long> ma;
    for (int i = 0; i < n; i++) {
      ma[x1[i] % delta]++;
    }
    for (int i = 0; i < m; i++) {
      ma[(x2[i] + (delta / 2LL)) % delta]++;
    }
    for (auto x : ma) {
      ans = max(ans, x.second);
    }
  }
  cout << ans << endl;
  return 0;
}
