You probably don’t think twice when you queue up at the grocery store or join a conga line at a wedding. But this type of single-file organization is a sophisticated form of collective social behavior. And as suggested by the children’s song “The Ants Go Marching One-By-One,” humans are not the only animals that appreciate the value of orderly lines.

But how far back in the history of living things on Earth does this behavior go? At least 480 million years, according to a study published on Thursday in Scientific Reports. It points to evidence of fossilized marine animals called trilobites lining up one-by-one during a time when complex life was still coming of age on Earth.

“Probably, collective behavior developed very early among various groups of arthropods,” said Jean Vannier, a paleontologist at the Université Claude Bernard Lyon 1 in France, and the study’s lead author.

Dr. Vannier and his colleagues examined specimens of Ampyx priscus found in Moroccan fossil beds, which preserve single-file lines containing as many as 22 of the small spiny arthropods. The fossils represent some of the oldest evidence of collective synchronized behavior in animals.