#include <bits/stdc++.h>
using namespace std;
const int INF = INT_MAX;
const long long LLNF = LLONG_MAX;
inline int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
inline int lcm(int a, int b) { return a * b / gcd(a, b); }
template <class T>
bool chmin(T& a, const T& b) {
  return b < a ? a = b, 1 : 0;
}
template <class T>
bool chmax(T& a, const T& b) {
  return a < b ? a = b, 1 : 0;
}
void test_case() {
  int n, m, inp;
  cin >> n;
  int a[101] = {0};
  for (int i = 0; i < (n); i++) {
    cin >> inp;
    a[inp]++;
  }
  cin >> m;
  int b[m];
  for (int i = 0; i < (m); i++) {
    cin >> b[i];
  }
  sort(b, b + m);
  int ans = 0;
  for (int i = 0; i < (m); i++) {
    if (b[i] - 1 >= 0 && a[b[i] - 1] > 0) {
      a[b[i] - 1]--;
      ans++;
    } else if (a[b[i]] > 0) {
      a[b[i]]--;
      ans++;
    } else if (b[i] + 1 < 101 && a[b[i] + 1] > 0) {
      a[b[i] + 1]--;
      ans++;
    }
  }
  cout << ans << '\n';
  return;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  test_case();
  return 0;
}
