#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  vector<int> b(n);
  for (int i = 0; i < n; ++i) {
    cin >> b[i];
  }
  int m;
  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());
  int p1 = 0;
  int p2 = 0;
  int ans = 0;
  while (p1 < n && p2 < m) {
    if (abs(b[p1] - g[p2]) <= 1) {
      ++ans;
      ++p1, ++p2;
    } else if (b[p1] - g[p2] > 1) {
      ++p2;
    } else if (g[p2] - b[p1] > 1) {
      ++p1;
    }
  }
  cout << ans << endl;
  return 0;
}
