input files should be in order. some of them are missed. 
if( !in.is_open() )
{
++count;
continue;
}