Guest User

Untitled

a guest
Apr 17th, 2020
278
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.33 KB | None | 0 0
  1. from collections import Counter
  2.  
  3. n = int(input())
  4. a = [int(i) for i in input().split()]
  5.  
  6. counter = Counter(a)
  7.  
  8. result = a[0]
  9. max_count = counter[result]
  10. for number, count in counter.items():
  11.     if count > max_count or (count == max_count and number > result):
  12.         result = number
  13.         max_count = count
  14.  
  15. print(result)
Advertisement
Add Comment
Please, Sign In to add comment