#include <bits/stdc++.h>
const long long N = 1e6 + 10;
const long long mod = 19260817;
using namespace std;
long long a[N], b[N];
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n, y;
  cin >> n >> y;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  long long m;
  cin >> m >> y;
  for (long long i = 1; i <= m; i++) cin >> b[i];
  long long ans = 0;
  for (long long d = 2; d <= 1e9; d *= 2) {
    map<long long, long long> m1, m2;
    for (long long i = 1; i <= n; i++) m1[a[i] % d]++;
    for (long long i = 1; i <= m; i++)
      m2[b[i] % d]++, ans = max(ans, m2[b[i] % d]);
    for (long long i = 1; i <= n; i++) {
      ans = max(ans, m1[a[i] % d] + m2[(a[i] % d + d / 2) % d]);
    }
  }
  cout << max(2LL, ans);
  return 0;
}
