You kind of know, going into it, that scientists who have spent their lives studying animal behavior are not going to love being asked, “What is the smartest bug?”

“It’s a tricky question and I don’t think anyone will give you a straight answer to it, unfortunately,” laughs Marc Srour, a biologist who specializes in invertebrates. He’s being nice: it is, I fully acknowledge, a pretty stupid question. But scientists themselves have, without using that phrasing, been attempting to answer it, and have been making progress. Insect intelligence is an under-studied field, but a particularly weird and dynamic one where huge discoveries are being made almost every year.

The biggest problem with asking about animal intelligence is defining what we even mean by “intelligence.” The animals generally thought of as smartest—among them the great apes, dolphins, and the octopus—are believed to be intelligent because they demonstrate some of the behaviors that we associate with our own superiority as humans. These qualities include problem solving, advanced communication, social skills, adaptability, and memory, and also physical traits like the comparative size of the brain or number of neurons in the brain.

Scientists study these qualities, but they study them individually, as concrete behaviors and attributes, and don’t usually like to then add up an animal species’ scores on those qualities and then declare them objectively intelligent.

Insects are a particularly difficult group of animals to study for these traits, because they’re just so different from us. Srour walked me through the basics of an insect’s brain, and holy god, they are so weird. Insects are extremely modular creatures, not like us at all: the easiest way to understand an insect’s nervous system is that an insect has many different sub-brains in different parts of its body, which feed into and can be controlled by a slightly larger central brain but can actually also operate separately. The antennae of an insect has its own brain. So does the mouth, the eyes, and each leg. Even if the central brain of an insect stops working, its legs still have their own sub-brains, and can keep walking.

Insects have, even considering their small size, a comparatively smaller central brain than we do, and with a much, much smaller neural count. Lars Chittka, perhaps the foremost researcher on the behavior of bees, told me that a bee has under a million neurons in its main brain. Humans? About a hundred billion.

Whether the amount of neurons or the physical size of the brain is related to intelligence is not really clear; researchers have no idea what humans are doing with all those neurons. But certainly there is a correlation between comparative brain size and the amount of those “intelligent” behaviors an animal can perform. In an insect, the key thing is the mushroom bodies, a pair of structures within the insect’s main brain that’s responsible for learning, memory, and, sort of, intelligence. Generally speaking, the larger the mushroom bodies, the smarter the insect.

There’s another angle as well, one that’s a little more complicated than just “big brain equals big smarts.” “Generalist insects tend to be the most intelligent,” says Srour. What he means is that insects, and animals in general, demonstrate more intelligence when they are equipped to adapt to all kinds of food sources and habitats. An animal that only eats one kind of leaf in one kind of tree doesn’t have to know very much; it can ignore all other information besides that which is directly related to that one leaf. “You can say in general that fleas and ticks, they’re not very intelligent,” says Srour. “They only have one purpose in life, and that’s to find their host and feed on their blood. They don’t have to do anything sophisticated so they don’t need very high brain functions.” Yeah, screw you, fleas and ticks, you idiots.

But a generalist animal has to do all kinds of intense thought to survive. Everything it sees can be a potential home, threat, or food source, and the animal has to constantly evaluate new stimuli to see if it can make use of it. A bee can feed on dozens of kinds of flowers, and must figure out the best bang for its buck as well as figuring out how to take advantage of it. The same goes for ants, which can feed on a wide variety of plant and animal matter. Ants leave scent trails for other ants to follow, a clear demonstration of social intelligence. Beetles don’t do that kind of thing; a beetle is a lone creature that doesn’t need to work with others for survival. Hell, a cat doesn’t even have to do that.

This all ties in with the “social brain hypothesis,” a theory put forth by anthropologist Robin Dunbar in 1998. The social brain hypothesis states that intelligence evolved in animals, including humans, specifically to work within and survive with social groups, not in order to solve any particular ecological problem. In other words, living in a group forces an individual to become smarter, rather than a smart individual choosing to live in a group.

“Ants, bees, and termites all have very high intelligence,” says Srour. “They have to recognize nest mates, communicate with them often.” The challenges of living within a large community require intelligence.

The three groups that are, according to Srour, up on the podium of smartest bugs, are the bees, the ants, and the cockroaches. Partially that’s biased because these are some of the best-studied insects of all, and it’s further biased because these insects behave, in some ways, more like humans than any other.

Which brings us to the honey bee.

Unlike most insects, the honey bee is a social animal, which forces it to have many intelligent abilities that non-social insects (like, say, flies, or beetles) don’t need. And its smarts are legion: the insects are able to recognize and distinguish between human faces, a surprising trait given that it isn’t really necessary for their survival. Another one: bees can count. In an experiment, honey bees were rewarded for stopping at the third in a series of landmarks, and proved able to remember this location and to thus count. (The distance was altered, while keeping the same number of landmarks, to discourage the bees from using their sense of distance.) Further study indicated their maximum counting abilities go to about four.

Bees are capable of observation, learning, and memory to solve problems. “Every bee is entirely flower-naive at the beginning of its foraging career,” says Chittka, meaning that the bee has no instinctive knowledge about how to score nectar or pollen from flowers. That’s trouble, because flowers are wildly divergent: different flowers will need entirely different strategies to exploit, and it’s up to each individual bee to figure out how to attack each different flower.

Bees can learn new strategies for getting food from other bees, something few other insects are capable of doing. Chittka told me about a technique called “nectar robbing,” in which bees figure out that it can be easier to bite a hole in a flower’s spur to suck out the nectar rather than figuring out how to get inside the flower. Other bees have proven able to observe this strategy, understand its purpose, master it themselves, and remember it for future flowers. That’s pretty smart!

But perhaps the best-known and most insane bit of intelligence from bees is what’s known as the “waggle dance.” This is a method of communication that the bee uses to tell other bees in the hive the location of a flower or source of food. Here’s how it works: a bee performs the dance on a vertical surface inside the hive. The dance is shaped like a coffee bean: roughly, an oval with a line down the middle. Dancing straight up means to fly in the direction of the sun, straight down means away from the sun, and left and right mean to fly to the left or the right of the sun.

The bee travels in a figure-eight pattern, tracing the line in the middle before performing the loops around the outside of the coffee bean shape. The amount of time it takes the bee to make its circuit around the outside of the coffee bean tells other bees how far away the food source is: a one-second loop means, roughly, that the food source is a kilometer away. The longer the loop, the farther away the food source is.

The bee will repeat this dance many times to indicate the quality of the food source: a really great one will find the bee doing this over and over again, yelling “IT’S A KILOMETER NORTHWEST OF HERE, IT’S A KILOMETER NORTHWEST OF HERE, IT’S A KILOMETER NORTHWEST OF HERE” for minutes on end. A decent but not quite as good source might find the bee repeating the message only a few times.

“The honey bee dance is unique insomuch as they’re using symbols,” says Chittka. “No other animal besides humans has that.” Even other primates don’t use symbols: an ape like a chimpanzee may point at a desired object, or lead others to it, but it won’t use an abstract symbol or message to indicate what it wants to convey. The honey bee’s waggle dance is a wildly intelligent attribute; it enables a bee to very efficiently convey detailed information to a large group, and also can be done in the safety of the hive, where other animals can’t overhear.

These behaviors are far above and beyond what most people would assume an insect is capable of. Without exaggerating, the honey bee is capable of advanced symbolic communication, language, facial recognition, number use, observation and mimicry, understanding of rules, and high-level problem-solving. They are, in some senses, significantly smarter than many mammals. Amazing.