#include <bits/stdc++.h>
using namespace std;
int n, m;
vector<int> a, b;
map<int, int> mp;
int main() {
  ios::sync_with_stdio(false);
  int tmp;
  cin >> n >> tmp;
  a.resize(n);
  for (auto &i : a) cin >> i, ++mp[i];
  cin >> m >> tmp;
  b.resize(m);
  for (auto &i : b) cin >> i, ++mp[i];
  int ans = 0;
  for (auto &i : mp) ans = max(ans, i.second);
  for (int step = 1; step <= 1000000000; step <<= 1) {
    mp.clear();
    for (auto &i : a) ++mp[i % (step * 2)];
    for (auto &i : b) ++mp[(i + step) % (step * 2)];
    for (auto &i : mp) ans = max(ans, i.second);
  }
  cout << ans << endl;
  return 0;
}
