#include<stdio.h>
int main() {
    int s[100],t[100],n,i,j,q,r[100],count=0;
    printf("enter number of n:");
    scanf("%d",&n);
     printf("enter number of q:");
    scanf("%d",&q);

    for(i=0;i<n;i++) {
                     printf("\n enter  n inputs:");
                     scanf("%d",&s[i]);

                     for(j=0;j<q;j++) {
                     printf("\n enter  q inputs:");
                     scanf("%d",&t[j]);
                     if(s[i]==t[j]) {
                                    r[j]=s[i];
                                    count++;
                                    }
                     }
               }

               printf("no of common things are:%d\n",count);
               printf("\n result is:");
               for(i=0;i<count;i++) {

                                    printf("%d ",r[i]);
                                    }
                                                                        return 0;
                                    }#include<stdio.h>
#define max 10000
main(){
  int i,j,n,q,f[max],s[max],count=0;
  scanf("%d",&n);
  for(i=0;i<n;i++)
    scanf("%d",&f[i]);
  scanf("%d",&q);
  for(i=0;i<q;i++)
    scanf("%d",&s[i]);
  for(i=0;i<q;i++)
    for(j=0;j<n;j++)
      if(f[j]==s[i]){
    count++;
    break;
      }
  printf("%d\n",count);
  return 0;
}