from collections import Counter print(sorted(Counter(map(int, input().split())).items(), key=lambda x: (-x[1], x[0]))[0][0])