#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n;
  vector<int> a(n, 0);
  for (int i = 0; i < n; i++) cin >> a[i];
  cin >> m;
  vector<int> b(m, 0);
  for (int i = 0; i < m; i++) cin >> b[i];
  int count = 0;
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (abs(a[i] - b[j]) <= 1) {
        count++;
        b[j] = INT_MAX;
        break;
      }
    }
  }
  cout << count << "\n";
  return 0;
}
