#include <cstdlib>
#include <cstdio>
#include <math.h>
#include <algorithm>
int n,q,t,minn,maxx,sol,sr,ss,i;
long long s[10000000];
using namespace std;
int bs(long long s[], int t, int minn, int maxx)
{
  if (maxx < minn)
    return 5987;
  else
    {
      int sr = (minn+maxx)/2;

      if (s[sr] > t)
     return bs(s, t, minn, sr-1);
      else if (s[sr] < t)
        return bs(s, t, sr+1, maxx);
      else
        return sr;
    }
}
int main()
{
   scanf("%d\n", &n);
   while(i<n)
   {
       scanf("%I64d", &s[i]);
       i++;
   }
scanf("%d", &q);
   i=0;
   while (i<q)
   {
       minn=s[0];
       maxx=s[n-1];
    scanf("%d", &t);
    sol=bs(s,t,minn,maxx);
    if (sol!=5987)
        ss++;
        i++;
   }
   printf("%d", ss);
    return 0;
}