finding three peaks