#include <bits/stdc++.h>
using namespace std;
int main() {
  int t = 1, n = 0, m = 0;
  cin >> n;
  vector<int> b(n);
  for (int i = 0; i < n; i++) {
    cin >> b[i];
  }
  cin >> m;
  vector<int> g(m);
  for (int i = 0; i < m; i++) {
    cin >> g[i];
  }
  sort(b.begin(), b.end());
  sort(g.begin(), g.end());
  multiset<pair<int, int> > s;
  int x = 0, y = 0;
  while (x != n && y != m) {
    if (abs(b[x] - g[y]) <= 1) {
      s.insert({b[x], g[y]});
      x++;
      y++;
    } else if (b[x] - g[y] > 1) {
      y++;
    } else if (b[x] - g[y] < 1) {
      x++;
    }
  }
  cout << s.size() << endl;
  return 0;
}
