You will need a C.P.F. if you are going to buy real estate in Brazil. Application for this is best done through a lawyer who will charge you in the region of a few hundred Reais. You will have to surrender your passport for a number of days whilst a Portuguese translation is obtained and the government issuing department named Receita Federal (literally Federal Receipts) verifies who you are. You will also need a mailing address in Brazil to receive the blue C.P.F. card.  When your passport is returned there will be a card attached in the back with various stamps and seals on it which identify your passport as being legally registered in Brazil. The blue card will arrive at your designated address within two weeks.