#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  long long int a[n];
  for (long long int i = 0; i < n; i++) cin >> a[i];
  long long int m;
  cin >> m;
  long long int b[m];
  for (long long int i = 0; i < m; i++) cin >> b[i];
  sort(a, a + n);
  sort(b, b + m);
  long long int p = 0;
  for (long long int i = 0; i < n; i++) {
    for (long long int j = 0; j < m; j++) {
      if (b[j] == 0 || abs(b[j] - a[i]) > 1)
        continue;
      else if (abs(b[j] - a[i]) <= 1) {
        p++;
        b[j] = 0;
        break;
      }
    }
  }
  cout << p;
}
