modifying map reduce to count only ends and start keys