#include <bits/stdc++.h>
const int MAX_LOG = 32;
int n, t, ans;
std::map<long long, int> map[MAX_LOG];
int main() {
  scanf("%d%d", &n, &t);
  for (int i = 0; i < n; ++i) {
    long long x;
    scanf("%lld", &x);
    for (int j = 0; j < MAX_LOG; ++j)
      ans = std::max(ans, ++map[j][x + (1LL << j) & (1LL << j + 1) - 1]);
  }
  scanf("%d%d", &n, &t);
  for (int i = 0; i < n; ++i) {
    long long x;
    scanf("%lld", &x);
    for (int j = 0; j < MAX_LOG; ++j)
      ans = std::max(ans, ++map[j][x & (1LL << j + 1) - 1]);
  }
  printf("%d\n", std::max(2, ans));
  return 0;
}
