Input Format
The first line contains an integer , the total number of country stamps.
The next  lines contains the name of the country where the stamp is from.
Constraints
Output Format
Output the total number of distinct country stamps on a single line.

hackerrank set add problem solution in python programming

Problem solution in Python 3 programming language.

stamps = set()
for _ in range(int(input())):
    stamps.add(input().strip())
print(len(stamps))

Second solution

# Enter your code here. Read input from STDIN. Print output to STDOUT
a = set()
[a.add(input()) for _ in range(int(input()))]
print(len(a))

Problem solution in Python 2 programming language.

stamps = set()
for _ in range(int(raw_input())):
    stamps.add(raw_input().strip())
print len(stamps)