Foreigners buy record number of Canadian securities