#include <bits/stdc++.h>
using namespace std;
int main() {
  int n1, count = 0;
  cin >> n1;
  int a[n1];
  for (int i = 0; i < n1; i++) {
    cin >> a[i];
  }
  int n2;
  cin >> n2;
  int b[n2];
  for (int i = 0; i < n2; i++) {
    cin >> b[i];
  }
  sort(a, a + n1);
  sort(b, b + n2);
  for (int i = 0; i < n1; i++)
    for (int j = 0; j < n2; j++)
      if (abs(a[i] - b[j]) < 2) {
        b[j] = 1000;
        count++;
        break;
      }
  cout << count << endl;
  return 0;
}
