public static void Main()
var array = new[] { 1, 5, 2, 7, 3, 4, 5 };
var powed = array.Select(x => { Console.WriteLine("Pow: " + x); return x * x; }).Distinct();
Console.WriteLine("-- Select.Distinct executed --");
Console.WriteLine("-- Count 1 executed --");
var count = powed.Count();
Console.WriteLine("-- Count 2 executed --");