Hosts Brazil finally found their form to reach the quarter-finals of the Olympic Games football tournament with a 4-0 win over Denmark.