#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m;
  map<long long, long long> boy, girl;
  cin >> n;
  while (n--) {
    long long e;
    cin >> e;
    boy[e]++;
  }
  cin >> m;
  while (m--) {
    long long e;
    cin >> e;
    girl[e]++;
  }
  long long ans = 0;
  for (auto i = boy.begin(); i != boy.end(); i++) {
    long long x = i->first;
    long long y = min(boy[x], girl[x - 1]);
    ans += y;
    boy[x] -= y;
    girl[x - 1] -= y;
    y = min(boy[x], girl[x]);
    ans += y;
    boy[x] -= y;
    girl[x] -= y;
    y = min(boy[x], girl[x + 1]);
    ans += y;
    boy[x] -= y;
    girl[x + 1] -= y;
  }
  cout << ans << endl;
}
