#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> mal;
  vector<int> dev;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    mal.push_back(x);
  }
  int m;
  cin >> m;
  for (int i = 0; i < m; i++) {
    int x;
    cin >> x;
    dev.push_back(x);
  }
  sort(mal.begin(), mal.end());
  sort(dev.begin(), dev.end());
  int i = 0;
  int j = 0;
  int res = 0;
  while (i < mal.size() && j < dev.size()) {
    if (abs(mal[i] - dev[j]) <= 1) {
      res++;
      i++;
      j++;
    } else {
      if (mal[i] < dev[j])
        i++;
      else
        j++;
    }
  }
  cout << res;
}
