#include <bits/stdc++.h>
long long const MAXLL = 0x7fffffffffffffffLL;
int const MAXINT = 0x7fffffff;
const int INF = 0x3f3f3f3f;
const double E = exp(1.0);
const double PI = acos(-1.0);
long long gcd(long long a, long long b) {
  while (b ^= a ^= b ^= a %= b)
    ;
  return a;
}
long long lcd(long long a, long long b) { return a * b / gcd(a, b); }
inline void write(long long x) {
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
void init_cin() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  std::cout.tie(nullptr);
}
using namespace std;
int cmp(pair<int, int> a, pair<int, int> b) {
  return a.first < b.first || (a.first == b.first && a.second < b.second);
}
const int N = 100 * 1000 + 555;
int n[2], y[2];
int x[2][N];
inline bool read() {
  for (int k = int(0); k < int(2); k++) {
    if (!(cin >> n[k] >> y[k])) return false;
    for (int i = int(0); i < int(n[k]); i++) assert(scanf("%d", &x[k][i]) == 1);
  }
  return true;
}
inline void solve() {
  int ans = 2;
  for (int dx = 1; dx < int(1e9); dx *= 2) {
    int mod = 2 * dx;
    map<int, int> cnt;
    int add[2] = {0, dx};
    for (int k = int(0); k < int(2); k++) {
      for (int i = int(0); i < int(n[k]); i++)
        cnt[(x[k][i] + add[k]) & (mod - 1)]++;
    }
    for (auto curAns : cnt) ans = max(ans, curAns.second);
  }
  cout << ans << endl;
}
int main() {
  if (read()) {
    solve();
  }
  return 0;
}
