#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, p;
  cin >> n;
  priority_queue<int, vector<int>, greater<int>> pq1, pq2;
  for (int i = 0; i < n; i++) {
    cin >> p;
    pq1.push(p);
  }
  cin >> m;
  for (int i = 0; i < m; i++) {
    cin >> p;
    pq2.push(p);
  }
  int ans = 0;
  while (!pq1.empty() && !pq2.empty()) {
    int x = pq1.top();
    int y = pq2.top();
    if (x - y <= 1 && x - y >= -1) {
      ans++;
      pq1.pop();
      pq2.pop();
    } else if (x < y)
      pq1.pop();
    else
      pq2.pop();
  }
  cout << ans;
}
