FR 2761 then FR 5713 at Madrid
Bari → Madrid → Budapest
Timetable, Madrid time
15:15FR 2761 from Bari at the gate
12:30FR 5713 to Budapest leaves the gate
21 h 15 apart on the timetable, overnight
FR 5713 leaves 21 h 15 after FR 2761 arrives on the timetable: more than half a day, so not a connection we count.