#include <bits/stdc++.h>
using namespace std;
int N, M;
signed long long A[101010], B[101010];
void solve() {
  int i, j, k, l, r, x, y;
  string s;
  cin >> N >> x;
  for (i = 0; i < (N); i++) cin >> A[i];
  cin >> M >> x;
  for (i = 0; i < (M); i++) cin >> B[i];
  int ret = 2;
  for (signed long long L = 2; L <= 1LL << 40; L <<= 1) {
    map<signed long long, int> mp;
    for (i = 0; i < (N); i++) mp[A[i] % L]++;
    for (i = 0; i < (M); i++) mp[(B[i] + L / 2) % L]++;
    for (auto& m : mp) ret = max(ret, m.second);
  }
  cout << ret << endl;
}
int main(int argc, char** argv) {
  string s;
  int i;
  if (argc == 1) ios::sync_with_stdio(false), cin.tie(0);
  for (i = 0; i < (argc - 1); i++) s += argv[i + 1], s += '\n';
  for (i = 0; i < (s.size()); i++) ungetc(s[s.size() - 1 - i], stdin);
  cout.tie(0);
  solve();
  return 0;
}
