#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int n, m;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  cin >> m;
  vector<int> b(m);
  for (int i = 0; i < m; i++) {
    cin >> b[i];
  }
  int a_ptr = 0;
  int b_ptr = 0;
  sort(a.begin(), a.end());
  sort(b.begin(), b.end());
  int cnt = 0;
  bool flag[m];
  for (int i = 0; i < m; i++) {
    flag[i] = false;
  }
  for (a_ptr = 0; a_ptr < n and b_ptr < m; a_ptr++) {
    int x = a[a_ptr];
    while (1) {
      int y = b[b_ptr];
      if (y > x + 1) {
        break;
      }
      if (b_ptr < m and abs(x - y) <= 1 and flag[b_ptr] == false) {
        cnt++;
        b_ptr++;
        flag[b_ptr] = false;
        break;
      }
      b_ptr++;
      if (b[b_ptr] > x + 1) {
        while (b_ptr > 0 and b[b_ptr] >= x - 1 and flag[b_ptr] == false) {
          b_ptr--;
        }
        break;
      }
    }
  }
  cout << cnt << endl;
  return 0;
}
