#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m, count = 0;
  cin >> n;
  vector<long long int> v(n);
  for (long long int i = 0; i < n; i++) {
    cin >> v[i];
  }
  cin >> m;
  vector<long long int> u(m);
  for (long long int i = 0; i < m; i++) {
    cin >> u[i];
  }
  sort(v.begin(), v.end());
  sort(u.begin(), u.end());
  for (long long int i = 0; i < v.size(); i++) {
    for (long long int j = 0; j < u.size(); j++) {
      if (abs(v[i] - u[j]) <= 1) {
        u[j] = (long long int)10e5;
        count++;
        break;
      }
    }
  }
  cout << count;
  return 0;
}
