One by one, relatives were called in to the hospital mortuary in the southern city of Bari and asked to confirm the identities of the deceased. Many left crying and yelling.
Three workers have been suspended and are under investigation, according to ANSA.
Along with documents and surveillance video of the train, the two black boxes found at the crash site will provide important evidence for the ongoing investigation, said Railway Police Regional Director Giancarlo Conticchio. No one has been charged in relation to the crash.
Among those at the hospital Wednesday was a cousin of passenger Pasqua Carmineo, a 30-year-old mother of two. Carmineo, who died in the wreck, was traveling to Bari to buy shoes, said the cousin, who asked not to be named.
Military troops and paramedics looked after the mourning relatives at the hospital, handing out water to those who needed it.
Earlier, Italian news agency ANSA reported a death toll of 27, but the agency changed its count to 23 on Wednesday, citing Puglia regional Gov. Michele Emiliano.
As relatives were coming to grips with their losses, local public prosecutor Francesco Giannella said Wednesday that at least one person is being investigated in relation to the crash and that human error might be to blame.
However, technical failures have not been ruled out as a cause of the crash, which happened on a single track about 15 kilometers (9.3 miles) south of the Adriatic Sea, between Andria and Corato, ANSA reported.
The trains were traveling toward each other at speeds between 62 mph and 68 mph (100 kph to 110 kph).
A train delay could be a factor in the crash, ANSA said. One train traveling north might have accidentally been given the green light due to the delay, the news agency reported.
A section of the single track isn't automated; trains still need to get approval to move ahead by telephone, according to ANSA.
Images distributed by firefighters at the scene showed the smashed remains of train cars and a large area of scattered, twisted metal about 7 kilometers (4.3 miles) east of Andria. A hospital in Andria appealed to the public for blood donations for the injured.
Italian Prime Minister Matteo Renzi promised a full inquiry. He met with officials in the region and pledged support, he told reporters Tuesday night in Bari.
"My thoughts go to the families of the victims," he said. "We are together in this pain and despair."
The state-run rail company FS Group offered condolences and said both trains were operated by the private company Ferrotramviaria SpA, which runs commuter rail services in the area.
"The employees of the Italian FS Group are close to the victims' families, the wounded and colleagues at Ferrotramviaria," the FS Group said.
The wreck happened in a relatively remote region. Authorities took to social media to ask doctors and medics in the area to go to the crash site and help the injured.
"It's not an area that's easily accessible. The closest highway is miles away," CNN contributor Barbie Nadeau said.