fork download
  1. kolvo = int(input())
  2. surnames = set()
  3. surnames1 = set()
  4. for _ in range(kolvo):
  5. surname = input()
  6. if surname in surnames:
  7. surnames1.add(surname)
  8. else:
  9. surnames.add(surname)
  10. if len(surnames1) == 0:
  11. print('0')
  12. else:
  13. print(len(surnames) + len(surnames1))
Success #stdin #stdout 0.02s 9212KB
stdin
3
в
а
п
stdout
0