#C2574. Top Selling Book
Top Selling Book
Top Selling Book
You are given a list of book sale records, where each record is represented by an integer indicating the book's ID. Your task is to determine the book that sold the most. In other words, find the ID that appears most frequently in the list. If there is a tie (i.e. more than one book with the maximum frequency), you may return any one of those IDs.
Input/Output Specifications: Your solution should read from standard input and write to standard output.
Hint: Use frequency counting methods to help you determine the number of sales for each book. For a formal representation, let \( f(x) \) be the frequency of book ID \( x \) in the list. You need to find an \( x \) that maximizes \( f(x) \).
inputFormat
The input consists of two lines:
- The first line contains an integer \( N \), representing the number of book sale records.
- The second line contains \( N \) space-separated integers, each representing a book ID.
outputFormat
Output a single integer which is the ID of the top-selling book.
## sample1
1
1
</p>