#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> boy(n);
  for (int i = 0; i < n; i++) {
    cin >> boy[i];
  }
  sort(boy.begin(), boy.end());
  int m;
  cin >> m;
  vector<int> girl(m);
  int res = 0;
  for (int i = 0; i < m; i++) {
    cin >> girl[i];
  }
  sort(girl.begin(), girl.end());
  int b = 0;
  int g = 0;
  for (; b < n && g < m;) {
    if (girl[g] == boy[b] || girl[g] == boy[b] + 1 || girl[g] == boy[b] - 1) {
      g++;
      b++;
      res++;
    } else {
      if (girl[g] < boy[b]) {
        g++;
      } else {
        b++;
      }
    }
  }
  cout << res;
  return 0;
}
