#include <bits/stdc++.h>
#pragma GCC optimize("Ofast", "unroll-loops")
using namespace std;
template <class T>
inline void sort(T &a) {
  sort(a.begin(), a.end());
}
template <class T>
inline void rsort(T &a) {
  sort(a.rbegin(), a.rend());
}
template <class T>
inline void reverse(T &a) {
  reverse(a.begin(), a.end());
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(9);
  srand(time(NULL));
  int n, y;
  cin >> n >> y;
  vector<int> arr(n);
  for (auto &i : arr) cin >> i;
  cin >> n >> y;
  vector<int> brr(n);
  for (auto &i : brr) cin >> i;
  int ans = 2, curr = 1;
  while (curr <= 1 << 29) {
    map<int, int> st1, st2;
    for (auto i : arr) st1[i % (2 * curr)]++;
    for (auto i : brr) st2[(i + curr) % (2 * curr)]++;
    for (auto i : st1)
      if (ans < i.second + st2[i.first]) ans = i.second + st2[i.first];
    for (auto i : st2)
      if (ans < i.second + st1[i.first]) ans = i.second + st1[i.first];
    curr *= 2;
  }
  cout << ans;
  return 0;
}
