using System;
using System.Collections.Generic;
public class Program
{
public static void Main()
Console.WriteLine("Hello World");
int [] x = new int[] { 99, 98, 92, 97,99,96,98,98,95};
Dictionary<int, int> d = new Dictionary<int, int>();
int majority = x.Length / 2;
//Stores the number of occcurences of each item in the passed array in a dictionary
foreach (int i in x)
if (d.ContainsKey(i))
d[i]++;
//Checks if element just added is the majority element
if (d[i] > majority)
Console.WriteLine(i);
}
else
d.Add(i, 1);