accurate code for estimating number of lines in input file