import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;


public class Main {

	public static void main(String[] args) throws Exception {
        // TODO ?????????????????????????????????????????????
		
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            line=br.readLine();
            Set<Integer> set1=new HashSet<Integer>();
            Set<Integer> set2=new HashSet<Integer>();
            line=br.readLine();
            String[] str=line.split(" ");
            for(int i=0;i<str.length;i++){
            	set1.add(Integer.parseInt(str[i]));
            }
            line=br.readLine();
            line=br.readLine();
            str=line.split(" ");
            for(int i=0;i<str.length;i++){
            	set2.add(Integer.parseInt(str[i]));
            }
            int result=0;
            if(set1.size()>set2.size()){
            	Iterator it=set2.iterator();
            	while(it.hasNext()){
            		if(set1.contains(it.next())){
            			result++;
            		}
            	}
            }else{
            	Iterator it=set1.iterator();
            	while(it.hasNext()){
            		if(set2.contains(it.next())){
            			result++;
            		}
            	}
            }
            System.out.println(result);
        }
	}

} import java.io.BufferedReader; BufferedReader java.io import java.io.InputStreamReader; InputStreamReader java.io import java.util.HashSet; HashSet java.util import java.util.Iterator; Iterator java.util import java.util.Set; Set java.util public class Main {

	public static void main(String[] args) throws Exception {
        // TODO ?????????????????????????????????????????????
		
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            line=br.readLine();
            Set<Integer> set1=new HashSet<Integer>();
            Set<Integer> set2=new HashSet<Integer>();
            line=br.readLine();
            String[] str=line.split(" ");
            for(int i=0;i<str.length;i++){
            	set1.add(Integer.parseInt(str[i]));
            }
            line=br.readLine();
            line=br.readLine();
            str=line.split(" ");
            for(int i=0;i<str.length;i++){
            	set2.add(Integer.parseInt(str[i]));
            }
            int result=0;
            if(set1.size()>set2.size()){
            	Iterator it=set2.iterator();
            	while(it.hasNext()){
            		if(set1.contains(it.next())){
            			result++;
            		}
            	}
            }else{
            	Iterator it=set1.iterator();
            	while(it.hasNext()){
            		if(set2.contains(it.next())){
            			result++;
            		}
            	}
            }
            System.out.println(result);
        }
	}

} Main public static void main(String[] args) throws Exception {
        // TODO ?????????????????????????????????????????????
		
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            line=br.readLine();
            Set<Integer> set1=new HashSet<Integer>();
            Set<Integer> set2=new HashSet<Integer>();
            line=br.readLine();
            String[] str=line.split(" ");
            for(int i=0;i<str.length;i++){
            	set1.add(Integer.parseInt(str[i]));
            }
            line=br.readLine();
            line=br.readLine();
            str=line.split(" ");
            for(int i=0;i<str.length;i++){
            	set2.add(Integer.parseInt(str[i]));
            }
            int result=0;
            if(set1.size()>set2.size()){
            	Iterator it=set2.iterator();
            	while(it.hasNext()){
            		if(set1.contains(it.next())){
            			result++;
            		}
            	}
            }else{
            	Iterator it=set1.iterator();
            	while(it.hasNext()){
            		if(set2.contains(it.next())){
            			result++;
            		}
            	}
            }
            System.out.println(result);
        }
	} main {
        // TODO ?????????????????????????????????????????????
		
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            line=br.readLine();
            Set<Integer> set1=new HashSet<Integer>();
            Set<Integer> set2=new HashSet<Integer>();
            line=br.readLine();
            String[] str=line.split(" ");
            for(int i=0;i<str.length;i++){
            	set1.add(Integer.parseInt(str[i]));
            }
            line=br.readLine();
            line=br.readLine();
            str=line.split(" ");
            for(int i=0;i<str.length;i++){
            	set2.add(Integer.parseInt(str[i]));
            }
            int result=0;
            if(set1.size()>set2.size()){
            	Iterator it=set2.iterator();
            	while(it.hasNext()){
            		if(set1.contains(it.next())){
            			result++;
            		}
            	}
            }else{
            	Iterator it=set1.iterator();
            	while(it.hasNext()){
            		if(set2.contains(it.next())){
            			result++;
            		}
            	}
            }
            System.out.println(result);
        }
	} try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            line=br.readLine();
            Set<Integer> set1=new HashSet<Integer>();
            Set<Integer> set2=new HashSet<Integer>();
            line=br.readLine();
            String[] str=line.split(" ");
            for(int i=0;i<str.length;i++){
            	set1.add(Integer.parseInt(str[i]));
            }
            line=br.readLine();
            line=br.readLine();
            str=line.split(" ");
            for(int i=0;i<str.length;i++){
            	set2.add(Integer.parseInt(str[i]));
            }
            int result=0;
            if(set1.size()>set2.size()){
            	Iterator it=set2.iterator();
            	while(it.hasNext()){
            		if(set1.contains(it.next())){
            			result++;
            		}
            	}
            }else{
            	Iterator it=set1.iterator();
            	while(it.hasNext()){
            		if(set2.contains(it.next())){
            			result++;
            		}
            	}
            }
            System.out.println(result);
        } {
            String line;
            line=br.readLine();
            Set<Integer> set1=new HashSet<Integer>();
            Set<Integer> set2=new HashSet<Integer>();
            line=br.readLine();
            String[] str=line.split(" ");
            for(int i=0;i<str.length;i++){
            	set1.add(Integer.parseInt(str[i]));
            }
            line=br.readLine();
            line=br.readLine();
            str=line.split(" ");
            for(int i=0;i<str.length;i++){
            	set2.add(Integer.parseInt(str[i]));
            }
            int result=0;
            if(set1.size()>set2.size()){
            	Iterator it=set2.iterator();
            	while(it.hasNext()){
            		if(set1.contains(it.next())){
            			result++;
            		}
            	}
            }else{
            	Iterator it=set1.iterator();
            	while(it.hasNext()){
            		if(set2.contains(it.next())){
            			result++;
            		}
            	}
            }
            System.out.println(result);
        } BufferedReader br = new BufferedReader(new InputStreamReader(System.in)) BufferedReader br = new BufferedReader(new InputStreamReader(System.in)) new BufferedReader(new InputStreamReader(System.in)) String line; line line=br.readLine() line br.readLine() br.readLine br Set<Integer> set1=new HashSet<Integer>(); set1 new HashSet<Integer>() Set<Integer> set2=new HashSet<Integer>(); set2 new HashSet<Integer>() line=br.readLine() line br.readLine() br.readLine br String[] str=line.split(" "); str line.split(" ") line.split line " " for(int i=0;i<str.length;i++){
            	set1.add(Integer.parseInt(str[i]));
            } int i=0; int i=0; i 0 i<str.length i str.length str str.length i++ i++ i {
            	set1.add(Integer.parseInt(str[i]));
            } {
            	set1.add(Integer.parseInt(str[i]));
            } set1.add(Integer.parseInt(str[i])) set1.add set1 Integer.parseInt(str[i]) Integer.parseInt Integer str[i] str i line=br.readLine() line br.readLine() br.readLine br line=br.readLine() line br.readLine() br.readLine br str=line.split(" ") str line.split(" ") line.split line " " for(int i=0;i<str.length;i++){
            	set2.add(Integer.parseInt(str[i]));
            } int i=0; int i=0; i 0 i<str.length i str.length str str.length i++ i++ i {
            	set2.add(Integer.parseInt(str[i]));
            } {
            	set2.add(Integer.parseInt(str[i]));
            } set2.add(Integer.parseInt(str[i])) set2.add set2 Integer.parseInt(str[i]) Integer.parseInt Integer str[i] str i int result=0; result 0 if(set1.size()>set2.size()){
            	Iterator it=set2.iterator();
            	while(it.hasNext()){
            		if(set1.contains(it.next())){
            			result++;
            		}
            	}
            }else{
            	Iterator it=set1.iterator();
            	while(it.hasNext()){
            		if(set2.contains(it.next())){
            			result++;
            		}
            	}
            } set1.size()>set2.size() set1.size() set1.size set1 set2.size() set2.size set2 {
            	Iterator it=set2.iterator();
            	while(it.hasNext()){
            		if(set1.contains(it.next())){
            			result++;
            		}
            	}
            } Iterator it=set2.iterator(); it set2.iterator() set2.iterator set2 while(it.hasNext()){
            		if(set1.contains(it.next())){
            			result++;
            		}
            	} it.hasNext() it.hasNext it {
            		if(set1.contains(it.next())){
            			result++;
            		}
            	} if(set1.contains(it.next())){
            			result++;
            		} set1.contains(it.next()) set1.contains set1 it.next() it.next it {
            			result++;
            		} result++ result {
            	Iterator it=set1.iterator();
            	while(it.hasNext()){
            		if(set2.contains(it.next())){
            			result++;
            		}
            	}
            } Iterator it=set1.iterator(); it set1.iterator() set1.iterator set1 while(it.hasNext()){
            		if(set2.contains(it.next())){
            			result++;
            		}
            	} it.hasNext() it.hasNext it {
            		if(set2.contains(it.next())){
            			result++;
            		}
            	} if(set2.contains(it.next())){
            			result++;
            		} set2.contains(it.next()) set2.contains set2 it.next() it.next it {
            			result++;
            		} result++ result System.out.println(result) System.out.println System.out System System.out result String[] args args public class Main {

	public static void main(String[] args) throws Exception {
        // TODO ?????????????????????????????????????????????
		
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            line=br.readLine();
            Set<Integer> set1=new HashSet<Integer>();
            Set<Integer> set2=new HashSet<Integer>();
            line=br.readLine();
            String[] str=line.split(" ");
            for(int i=0;i<str.length;i++){
            	set1.add(Integer.parseInt(str[i]));
            }
            line=br.readLine();
            line=br.readLine();
            str=line.split(" ");
            for(int i=0;i<str.length;i++){
            	set2.add(Integer.parseInt(str[i]));
            }
            int result=0;
            if(set1.size()>set2.size()){
            	Iterator it=set2.iterator();
            	while(it.hasNext()){
            		if(set1.contains(it.next())){
            			result++;
            		}
            	}
            }else{
            	Iterator it=set1.iterator();
            	while(it.hasNext()){
            		if(set2.contains(it.next())){
            			result++;
            		}
            	}
            }
            System.out.println(result);
        }
	}

} public class Main {

	public static void main(String[] args) throws Exception {
        // TODO ?????????????????????????????????????????????
		
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            line=br.readLine();
            Set<Integer> set1=new HashSet<Integer>();
            Set<Integer> set2=new HashSet<Integer>();
            line=br.readLine();
            String[] str=line.split(" ");
            for(int i=0;i<str.length;i++){
            	set1.add(Integer.parseInt(str[i]));
            }
            line=br.readLine();
            line=br.readLine();
            str=line.split(" ");
            for(int i=0;i<str.length;i++){
            	set2.add(Integer.parseInt(str[i]));
            }
            int result=0;
            if(set1.size()>set2.size()){
            	Iterator it=set2.iterator();
            	while(it.hasNext()){
            		if(set1.contains(it.next())){
            			result++;
            		}
            	}
            }else{
            	Iterator it=set1.iterator();
            	while(it.hasNext()){
            		if(set2.contains(it.next())){
            			result++;
            		}
            	}
            }
            System.out.println(result);
        }
	}

} Main
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;


public class Main {

	public static void main(String[] args) throws Exception {
        // TODO ?????????????????????????????????????????????
		
        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            line=br.readLine();
            Set<Integer> set1=new HashSet<Integer>();
            Set<Integer> set2=new HashSet<Integer>();
            line=br.readLine();
            String[] str=line.split(" ");
            for(int i=0;i<str.length;i++){
            	set1.add(Integer.parseInt(str[i]));
            }
            line=br.readLine();
            line=br.readLine();
            str=line.split(" ");
            for(int i=0;i<str.length;i++){
            	set2.add(Integer.parseInt(str[i]));
            }
            int result=0;
            if(set1.size()>set2.size()){
            	Iterator it=set2.iterator();
            	while(it.hasNext()){
            		if(set1.contains(it.next())){
            			result++;
            		}
            	}
            }else{
            	Iterator it=set1.iterator();
            	while(it.hasNext()){
            		if(set2.contains(it.next())){
            			result++;
            		}
            	}
            }
            System.out.println(result);
        }
	}

}