map reduce to count events