Answer: The Shulchan Aruch (OC 590:2) writes that one must listen to at least 30 sounds of a shofar.
The Mishna Berura (585:11) writes that one who wasn’t present for the berachos should recite them quietly by themselves before the baal tokea begins blowing. If one comes in and doesn’t have time to recite the berachos before the blowing then one can no longer do so as they have fulfilled the mitzva mideoraisa by hearing thirty blasts.
The Kaf Hachaim (OC 585:39) quotes the Pri Haaretz (9) who writes that one can still recite the berachos. Tosafos (Sukka 39a) and the Rosh (Sukka 3:33) write that if one picks up the lulav and esrog before they said the berachos they can still recite them as they are still involved in performing the mitzva when they shake them (See Mishna Berura 651:26). Likewise, when one is in the middle of listening to the shofar, one may still recite the berachos. The Kaf Hachaim challenges this, however, writing that one has essentially completed the mitzva.
Nonetheless, R’ Asher Weiss (Ki Savo 5765) writes that one can recite the berachos as one is still in the process of fulfilling the mitzva. One may even do so in between the berachos of one’s own amida if necessary.
In conclusion, one who comes late to hear the shofar should recite the berachos quietly. If they arrive as the shofar begins, they should recite them before the next set. It is important to hear at least thirty blasts.