using System.Collections.Generic;
public static void Main()
int[] moviesRented = [17, 3, 3, 2, 2, 2, 1, 1, 1, 1];
var counts = new Dictionary<int, int>();
foreach(var item in moviesRented){
var count = moviesRented.Count(i => i == item);
var ordered = counts.OrderByDescending(v => v.Value);
foreach(var item in ordered){
Console.WriteLine($"{item.Value} occurrence of {item.Key}");