#include <bits/stdc++.h>
using namespace std;
using lli = long long;
using ld = long double;
mt19937 rnd(time(nullptr));
inline void Solve() {
  lli n = 0, y1 = 0;
  cin >> n >> y1;
  vector<lli> a(n);
  for (auto &it : a) cin >> it;
  lli m = 0, y2 = 0;
  cin >> m >> y2;
  vector<lli> b(m);
  for (auto &it : b) cin >> it;
  lli result = 0;
  for (lli d = 1; d < (1LL << 31); d *= 2) {
    map<lli, lli> counter;
    for (auto it : a) counter[it % (2LL * d)]++;
    for (auto it : b) counter[((it) % (2LL * d) + d) % (2LL * d)]++;
    for (auto it : counter) result = max(result, it.second);
  }
  map<lli, lli> counter;
  for (auto it : a) counter[it]++;
  for (auto it : b) counter[it]++;
  for (auto it : counter) result = max(result, it.second);
  cout << result;
}
signed main() {
  cout << fixed << setprecision(20);
  Solve();
  return 0;
}
