added function that counts records of distance file