#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> b;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    b.push_back(x);
  }
  int m;
  cin >> m;
  map<int, int> mp;
  for (int i = 0; i < m; i++) {
    int x;
    cin >> x;
    mp[x]++;
  }
  sort(b.begin(), b.end());
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (mp[b[i] - 1] > 0) {
      mp[b[i] - 1]--;
      ans++;
    } else if (mp[b[i]] > 0) {
      mp[b[i]]--;
      ans++;
    } else if (mp[b[i] + 1] > 0) {
      mp[b[i] + 1]--;
      ans++;
    }
  }
  cout << ans << endl;
  return 0;
}
