#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctype.h>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>

using namespace std;

#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i, n) REP(i, 0, n)
#define lengthof(x) (sizeof(x) / sizeof(*(x)))
#define FILL(ptr, value) FILL_((ptr), sizeof(ptr)/sizeof(value), (value))
template <typename T>
void FILL_(void * ptr, size_t size, T value){
  std::fill((T*)ptr, (T*)ptr+size, value);
}
//4方向ベクトル→↑←↓
int dx[] ={1,0,-1,0};
int dy[] ={0,-1,0,1};
int n;
int main()
{
  cin >>n;
  vector<int> s(n);
  int x;
  int ans = 0;
  for(int i = 0;i < n;i++){
    cin >>x;
    s.push_back(x);
  }
  int q;
  cin >>q;
  vector<int> t(q);
  int y
  for(int i = 0;i < q;i++){
    cin >>y;
    t.push_back(y);
  }
  sort(t.begin(),t.end());
  for(int i = 0;i <s.size();i++){
    int search = s[i];
    int left = 0;
    int right =t.size()-1;
    while(left <=right){
      int mid = (left+right)/2;
      if(search >t[mid]){
	left = mid+1;
      }else if(search <t[mid]){
	right = mid-1;
      }else{
	ans++;
	break;
      }
    }
  }
  cout <<ans<<endl;
  return 0;
}