The Bank of Spain estimated that the country had a shortage of about 550,000 homes last year, with Madrid, Barcelona and Valencia accounting for a substantial share.