#include <bits/stdc++.h>
using namespace std;
const long long N = 1e6 + 9;
long long n, m;
long long a[N], b[N];
long long ans;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cerr << "‌";
  cin >> n;
  for (int i = 0; i < (n); i++) cin >> a[i];
  cin >> m;
  for (int i = 0; i < (m); i++) cin >> b[i];
  sort(a, a + n);
  sort(b, b + m);
  long long l = 0, r = 0;
  a[n] = 1e10;
  b[m] = 1e10 + 2;
  while (l != n || r != m) {
    if (abs(a[l] - b[r]) <= 1)
      ans++, l++, r++;
    else if (a[l] > b[r])
      r = ((m) < (r + 1) ? (m) : (r + 1));
    else if (b[r] > a[l])
      l = ((n) < (l + 1) ? (n) : (l + 1));
  }
  cout << ans << endl;
}
