#include <bits/stdc++.h>
using namespace std;
int a[1000];
int b[1000];
bool visita[1000];
bool visitb[1000];
int main() {
  int n, m;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  cin >> m;
  for (int i = 0; i < m; i++) cin >> b[i];
  int c = 0;
  sort(a, a + n);
  sort(b, b + m);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (abs(a[i] - b[j]) <= 1 && visita[i] == false && visitb[j] == false) {
        visita[i] = true;
        visitb[j] = true;
        c++;
      }
    }
  }
  cout << c << endl;
}
