728x90
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashSet;
import java.util.StringTokenizer;
public class StringSet {
public static void main(String[] args) throws IOException {
int n,m;
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
n = Integer.parseInt(st.nextToken());
m = Integer.parseInt(st.nextToken());
HashSet<String>hs = new HashSet<>();
String gets = "";
for(int i=0; i<n; i++){
gets = br.readLine();
hs.add(gets);
}
int count =0;
String checks ="";
for(int i=0; i<m; i++){
checks = br.readLine();
if(hs.contains(checks)){
count++;
}
}
System.out.println(count);
}
}