#include <bits/stdc++.h>
using namespace std;
ostream& operator<<(ostream& os, vector<int> v) {
  for (auto e : v) os << e << ", ";
  os << endl;
  return os;
}
int main() {
  int n, m;
  vector<int>* c;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  cin >> m;
  vector<int> b(m);
  for (int i = 0; i < m; i++) cin >> b[i];
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  int i = 0, j = 0;
  int matches = 0;
  while (i < a.size() && j < b.size()) {
    int diff = a[i] - b[j];
    if (abs(diff) <= 1) {
      matches++;
      i++;
      j++;
    } else if (diff < 0)
      i++;
    else
      j++;
  }
  cout << matches << endl;
  return 0;
}
