#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  vector<int> boy(n);
  for (int i = 0; i < n; ++i) {
    cin >> boy[i];
  }
  sort(boy.begin(), boy.end());
  cin >> n;
  vector<int> girl(n);
  for (int i = 0; i < n; ++i) {
    cin >> girl[i];
  }
  sort(girl.begin(), girl.end());
  int it1 = 0, it2 = 0, cnt = 0;
  while (it1 < boy.size() && it2 < girl.size()) {
    if (abs(boy[it1] - girl[it2]) <= 1) {
      cnt++;
      it1++;
      it2++;
    } else {
      if (boy[it1] > girl[it2])
        it2++;
      else
        it1++;
    }
  }
  cout << cnt << endl;
}
