Input Format
The first line contains an integer, , the number of students who have subscribed to the English newspaper.
The second line contains  space separated roll numbers of those students.
The third line contains , the number of students who have subscribed to the French newspaper.
The fourth line contains  space separated roll numbers of those students.
Constraints
Output Format
Output the total number of students who have at least one subscription.

hackerrank set union operation problem solution in python programming

Problem solution in Python 3 programming language.

E = int(input())
English = set(raw_input().split())

F = int(input())
French = set(input().split())

print(len(English | French))

Second solution

# Enter your code here. Read input from STDIN. Print output to STDOUT
n = int(input())
l = list(input().split())
m = int(input())
k = list(input().split())
s1 = set(l)
s2 = set(k)
print(len(s1.union(s2)))

Problem solution in Python 2 programming language.

E = int(raw_input())
English = set(raw_input().split())

F = int(raw_input())
French = set(raw_input().split())

print len(English | French)