#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, i, x;
  vector<int> boy;
  vector<int> girl;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> x;
    boy.push_back(x);
  }
  cin >> m;
  for (i = 0; i < m; i++) {
    cin >> x;
    girl.push_back(x);
  }
  sort(boy.begin(), boy.end());
  sort(girl.begin(), girl.end());
  int cnt = 0;
  for (i = 0; i < n; i++)
    for (int j = 0; j < m; j++)
      if (abs(boy[i] - girl[j]) <= 1) {
        girl[j] = 1000;
        cnt++;
        break;
      }
  cout << cnt << endl;
  return 0;
}
