Add for_each_n() algorithm