#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
vector<int> v[N];
int vis[N];
set<long long> s;
map<long long, long long> mp;
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, cnt = 0, sum = 0, ans = 0, x, m, l, r;
  cin >> n;
  long long a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  cin >> m;
  long long b[m];
  for (int i = 0; i < m; i++) {
    cin >> b[i];
    mp[b[i]]++;
  }
  sort(a, a + n);
  sort(b, b + m);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (abs(a[i] - b[j]) <= 1 && mp[b[j]]) {
        cnt++;
        mp[b[j]]--;
        break;
      }
    }
  }
  cout << cnt << endl;
}
