Yugoslavia actually has 8, Biggie Smalls is correct, but those are only the men's medals for Yugoslavia. The women won bronze in 1980 and 1988. Serbia does only have two.
There is also the silver medal in 1996, which was post-war Yugoslavia (Serbia and Montenegro essentially). Whether Serbia inherits these medals or not is always debated but from that team only Paspalj, Danilovic and Savic were born outside of Serbia and all of them consider themselves ethnic Serbs.
Serbia (Silver (M) and Bronze (W) in 2016, 3x3 Bronze (M) in 2021)
China (Silver (W) in 1992, Bronze (W) in 1984 and 3x3 Bronze (W) in 2021)
Do these medals come from men's and women's basketball?