#include <bits/stdc++.h>
using namespace std;
int a, arr[10000], b, brr[10000], cnt;
int main() {
  cin >> a;
  for (int i = 0; i < a; i++) cin >> arr[i];
  cin >> b;
  for (int i = 0; i < b; i++) cin >> brr[i];
  sort(arr, arr + a);
  sort(brr, brr + b);
  for (int i = 0; i < a; i++)
    for (int j = 0; j < b; j++)
      if (abs(arr[i] - brr[j]) <= 1) {
        brr[j] = 1000;
        cnt++;
        break;
      }
  cout << cnt;
}
