#include<cstdio>
int n,s[100000],q,t,c,l,m,r,i,j;
int main(){
  for(scanf("%d",&n);i<n;scanf("%d",&s[i++]));
  for(scanf("%d",&q);j++<q;){
    l=0,r=n,scanf("%d",&t);
    while(m=(l+r)/2,l<r){
      t-s[m]||(l=r,c++);
      t<s[m]&&(r=m);
      t>s[m]&&(l=m+1);
    }
  }
  printf("%d\n",c);
}