Count Occurrences Of Each Element In A Period