#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int i, j, m, n, c = 0;
  cin >> n;
  vector<long long int> v(n), v1(n);
  for (i = 0; i < n; i++) {
    cin >> v[i];
    v1[i] = 0;
  }
  cin >> m;
  vector<long long int> v3(m), v2(m);
  for (j = 0; j < m; j++) {
    cin >> v2[j];
    v3[j] = 0;
  }
  sort(v.begin(), v.end());
  sort(v2.begin(), v2.end());
  for (i = 0; i < n; i++) {
    for (j = 0; j < m; j++) {
      if (v1[i] == 0 && v3[j] == 0) {
        if (abs(v[i] - v2[j]) <= 1) {
          c++;
          v1[i] = 1;
          v3[j] = 1;
        }
      }
    }
  }
  cout << c;
}
