Collective intelligence of ants solving a puzzle