Avoid overflowing for_each_n's counter for input size near the threshold.
Merge pull request #321 from jaredhoberock/for_each_n

Avoid overflowing for_each_n's counter for input size near the threshold...