#include <bits/stdc++.h>
using namespace std;
const int mod = (int)1e9 + 7;
const int MOD = (int)998244353;
const int INF = (int)1e18;
bool cmp(const pair<int, int>& a, const pair<int, int>& b) {
  return a.second - a.first < b.second - b.first;
}
void solve() {
  int n, k;
  cin >> n;
  int a[n];
  for (long long i = 0; i < n; i++) cin >> a[i];
  cin >> k;
  int b[k];
  for (long long i = 0; i < k; i++) cin >> b[i];
  sort(a, a + n);
  sort(b, b + k);
  int cnt = 0, j = 0;
  for (long long i = 0; i < n; i++)
    for (long long j = 0; j < k; j++) {
      if (abs(a[i] - b[j]) <= 1) {
        b[j] = 1000;
        cnt++;
        break;
      }
    }
  cout << cnt;
  return;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t = 1;
  while (t--) {
    solve();
  }
}
