#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
long long a[N];
long long b[N];
void solve() {
  int n, y1;
  cin >> n >> y1;
  for (int i = 1; i <= n; ++i) cin >> a[i];
  sort(a + 1, a + 1 + n);
  int m, y2;
  cin >> m >> y2;
  for (int i = 1; i <= m; ++i) cin >> b[i];
  sort(b + 1, b + 1 + m);
  int mi = min(a[1], b[1]);
  map<int, int> mp;
  for (int i = 1; i <= n; ++i) a[i] -= mi, mp[a[i]]++;
  for (int i = 1; i <= m; ++i) b[i] -= mi, mp[b[i]]++;
  int ans = 0;
  for (auto p : mp) ans = max(ans, p.second);
  for (int i = 1; i <= 30; ++i) {
    int step = 1 << i;
    mp.clear();
    for (int i = 1; i <= n; ++i) mp[a[i] % step]++;
    for (int i = 1; i <= m; ++i) mp[(b[i] % step + step / 2) % step]++;
    for (auto p : mp) ans = max(ans, p.second);
  }
  cout << ans << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  int T = 1;
  while (T--) {
    solve();
  }
  return 0;
}
