The Fourth of July turned into one of the most violent days of the year — with cops reporting 12 people shot, most in Brooklyn, between 5 p.m. and midnight.

One victim died, a 33-year-old man shot in the head while standing in the entryway to his home in the Flatlands section.

His name was withheld pending notification of relatives.

The violence included two multiple shootouts that left five people injured.

The shootouts, which were apparently unrelated, occurred within 15 minutes of each other.

Two men and a woman were shot near Gates and Marcy avenues in Bedford-Stuyvesant at 11:17 p.m.

Fifteen minutes later, at Riverdale and Thatford Avenues in Brownsville, two men were hit.

Three other people were shot in Bed-Stuy, two in The Bronx and one in Manhattan.