After a day of intense political drama , which was marked by bombings , backroom negotiations and jubilant demonstrations , the assembly agreed by 560 votes to 4 to replace King Gyanendra with a president .