Write a program to determine the winner of a tournament and calculate the total number of matches required to identify the winner?
using System; using System.Collections.Generic;class Tournament {static void Main(){int totalTeams = 128;List teams = new List();for (int i = 1; i <= totalTeams; i ){teams.Add("Team " i);}int round = 1;while (teams.Count > 1){Console.WriteLine($"Round {round}: {teams.Count} teams remaining");teams = KnockoutRound(teams);round ;}Console.WriteLine($"The winner is {teams[0]}!");}static List KnockoutRound(List teams){List winners = new List();for (int i = 0; i < teams.Count; i = 2){string winner = SimulateMatch(teams[i], teams[i 1]);winners.Add(winner);Console.WriteLine($"{teams[i]} vs {teams[i 1]} - Winner: {winner}");}return winners;}static string SimulateMatch(string team1, string team2){Random rand = new Random();return rand.Next(0, 2) == 0 ? team1 : team2;} }