# Enter your code here. Read input from STDIN. Print output to STDOUT num1, st1, num2, st2 = (set(input().split()) for i in range(4)) print(len(st1.intersection(st2)))
Here is what the above code is Doing:
1. The first line is taking input from the user and splitting it into 4 sets.
2. The second line is printing the length of the intersection of the two sets.