#include <bits/stdc++.h>
using namespace std;
const int mod = 1000 * 1000 * 1000 + 7;
const int inf = 1000 * 1000 * 1000 + 100;
const long long inf64 = (long long)1e18;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(10);
  int n, qan = 0;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int m;
  cin >> m;
  vector<int> b(m);
  for (int i = 0; i < m; i++) {
    cin >> b[i];
  }
  sort(b.begin(), b.end());
  sort(a.begin(), a.end());
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (abs(b[j] - a[i]) <= 1) {
        qan++;
        b[j] = inf;
        break;
      }
    }
  }
  cout << qan << "\n";
  return 0;
}
