#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-13;
const long double PI = acos(-1);
const long long INFF = (long long)1e18;
const int INF = (int)1e9;
const int mod = (int)1e9 + 7;
const int MXN = (int)2e5 + 7;
int a[MXN], b[MXN];
map<int, int> mp;
int main(void) {
  int n, y11;
  scanf("%d %d", &n, &y11);
  ;
  for (int i = (1); i < (n + 1); ++i) scanf("%d", a + i);
  int m, y22;
  scanf("%d %d", &m, &y22);
  ;
  for (int i = (1); i < (m + 1); ++i) scanf("%d", b + i);
  int ans = 0;
  for (int i = 0; i < (31); ++i) {
    long long d = 1 << i;
    mp.clear();
    for (int i = (1); i < (n + 1); ++i) mp[a[i] % (2 * d)]++;
    for (int i = (1); i < (m + 1); ++i) mp[(b[i] + d) % (2 * d)]++;
    for (auto x : mp) ans = max(ans, x.second);
  }
  mp.clear();
  for (int i = (1); i < (n + 1); ++i) mp[a[i]]++;
  for (int i = (1); i < (m + 1); ++i)
    if (mp[b[i]]) {
      ans = max(ans, 2);
      break;
    }
  printf("%d\n", ans);
  return 0;
}
