XElement e = XElement.Load("c:\\LandD.xml");
// Retrieve a list of bugs marked as "Not a Bug"
var query =
from c in e.Descendants("defect-event").Elements()
where (string)c.Attribute("field-value") == "Not a Bug"
select c.Parent.Parent.Element("record-id").Value;
// Print distinct bug numbers
foreach (string d in query.Distinct())
Console.Write("{0},", d);
Console.WriteLine();
// Print count (distinct)
Console.WriteLine("Total number of 'Not a Bug' bugs: {0}", query.Distinct().Count());
Console.Read();