#include <bits/stdc++.h>
#pragma comment(linker, "/STACk:1024000000,1024000000")
using std::pair;
const int maxn = 1e5 + 10;
const int maxm = 1e6 + 10;
const int mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;
const long long INF = 0x3f3f3f3f3f3f3f3f;
const double dinf = 1e20;
using namespace std;
long long read() {
  long long X = 0, p = 1;
  char c = getchar();
  for (; c > '9' || c < '0'; c = getchar())
    if (c == '-') p = -1;
  for (; c >= '0' && c <= '9'; c = getchar()) X = X * 10 + c - '0';
  return X * p;
}
int up[maxn], down[maxn], ans = 2, n, m;
map<int, int> mp;
int main() {
  int t;
  cin >> n >> t;
  for (int i = 1; i <= n; i++) cin >> up[i];
  cin >> m >> t;
  for (int i = 1; i <= m; i++) cin >> down[i];
  for (int d = 2; d <= 1e9; d <<= 1) {
    mp.clear();
    for (int i = 1; i <= n; i++) {
      ++mp[up[i] % d];
      ans = max(ans, mp[up[i] % d]);
    }
    for (int i = 1; i <= m; i++) {
      ++mp[(down[i] + (d >> 1)) % d];
      ans = max(ans, mp[(down[i] + (d >> 1)) % d]);
    }
  }
  cout << ans << endl;
}
