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