#include <bits/stdc++.h>
using std::cin;
using std::cout;
using std::map;
int main() {
  int n;
  cin >> n;
  map<int, int> a;
  for (int i = 0; i < n; ++i) {
    int t;
    cin >> t;
    map<int, int>::iterator it = a.find(t);
    if (it != a.end())
      it->second++;
    else
      a[t] = 1;
  }
  int m;
  cin >> m;
  map<int, int> b;
  for (int i = 0; i < m; ++i) {
    int t;
    cin >> t;
    map<int, int>::iterator it = b.find(t);
    if (it != b.end())
      it->second++;
    else
      b[t] = 1;
  }
  int count = 0;
  for (map<int, int>::iterator i = a.begin(); i != a.end(); ++i) {
    int d;
    map<int, int>::iterator it = b.find(i->first - 1);
    if (it != b.end()) {
      d = std::min(i->second, it->second);
      i->second -= d;
      it->second -= d;
      count += d;
    }
    it = b.find(i->first);
    if (it != b.end()) {
      d = std::min(i->second, it->second);
      i->second -= d;
      it->second -= d;
      count += d;
    }
    it = b.find(i->first + 1);
    if (it != b.end()) {
      d = std::min(i->second, it->second);
      i->second -= d;
      it->second -= d;
      count += d;
    }
  }
  cout << count;
  return 0;
}
