using System.Text;

string[] numbers;
using (FileStream fstream = File.OpenRead("../../../../var/result/data.txt")){
    byte[] buffer = new byte[fstream.Length];
    await fstream.ReadAsync(buffer, 0, buffer.Length);
    string text = Encoding.Default.GetString(buffer);
    text = text.Replace("\r\n",";");
    numbers = text.Split(new char[]{';'});
}
int maxNumber = 0;
int maxNumberCount = 0;
foreach(var number in numbers){
    if(Convert.ToInt32(number) < maxNumber){
        continue;
    }
    if(Convert.ToInt32(number) == maxNumber){
        maxNumberCount++;
        continue;
    }
    if(Convert.ToInt32(number) > maxNumber){
        maxNumber = Convert.ToInt32(number);
        maxNumberCount = 1;
    }
}
using(FileStream fstream = new FileStream("../../../../var/result/result.txt", FileMode.OpenOrCreate)){
        byte[] buffer = Encoding.Default.GetBytes(maxNumberCount.ToString());
        await fstream.WriteAsync(buffer, 0, buffer.Length);
}
Console.WriteLine(maxNumberCount);