Use condition with LongCount operator
using System; using System.Linq; using System.Collections; using System.Collections.Generic; class Program// w ww . j a v a 2s . c o m { static void Main(string[] args) { long count = Enumerable. Range(0, int.MaxValue). Concat(Enumerable.Range(0, int.MaxValue)). LongCount(n => n > 1 && n < 4); Console.WriteLine(count); } }