HackathonMar 17, 2025

Favourite Singer

Hazrat Ali

Hackathon

Bob has a playlist of N songs, each song has a singer associated with it (denoted by an integer)

Favourite singer of Bob is the one whose songs are the most on the playlist

Count the number of Favourite Singers of Bob

Input Format 

The first line contains an integer N, denoting the number of songs in Bob's playlist.

The following input contains N integers, ith integer denoting the singer of the ith song.

Output Format

Output a single integer, the number of favourite singers of Bob

Note: Use 64 bit data type

Constraints

1≤N≤2∗1051≤a[i]≤1015

Sample Input
 
 
5
1 1 2 2 4
Sample Output
2
 
Solution : 
 
from collections import Counter
n = int(input())
a = list(map(int, input().split()))[:n]
c = Counter(a)
maxi = max(c.values())
print(list(c.values()).count(maxi))
 
 
 

Comments