#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int ar[n];
  for (int i = 0; i < n; i++) {
    cin >> ar[i];
  }
  sort(ar, ar + n);
  int m;
  cin >> m;
  int a[m];
  for (int i = 0; i < m; i++) {
    cin >> a[i];
  }
  int cnt = 0;
  sort(a, a + m);
  for (int i = 0; i < n; i++) {
    int x = ar[i];
    for (int i = 0; i < m; i++) {
      if (abs(a[i] - x) <= 1) {
        cnt++;
        a[i] = 120;
        break;
      }
    }
  }
  cout << cnt << endl;
  return 0;
}
