When Jorge Moreira de Oliveira's great-great-great-great-great-grandfather arrived in Brazil in the 18th century he was counted off the slave-ship, branded and dispatched to a goldmine deep in the country's arid mid-west. After years of scrambling for gold that was shipped to Europe, he fled and became one of the founding fathers of the Kalunga quilombo, a remote mountain-top community of runaway slaves.
On Wednesday last week, more than 200 years later, it was Moreira's turn to be counted – this time not by slavemasters but by Cleber, a chubby census taker who appeared at his home clutching a blue personal digital assistant (PDA).
"I'm Kalunga. A Brazilian Kalunga," Moreira told his visitor from the Brazilian Institute of Geography and Statistics, who diligently noted down details about the interviewee's eight children, monthly income and toilet arrangements.
Such is Brazil's 2010 census – a gigantic logistical operation that aims to count and analyse the lives of more than 190 million people in one of the most geographically and racially diverse nations on earth.
The scale of the mobilisation is staggering. With a budget of around 1.677bn Brazilian reais (£600m) the census, which began on 1 August, will peer into approximately 58m homes in 5,565 municipalities across 8,514,876 sq km (3.3m sq miles). Between now and the end of October around 190,000 census takers will venture into illegal goldmines, sprawling slums, high-security prisons, indigenous reserves and quilombola communities such as Engenho II, travelling by motorbike, donkey, canoe and plane.
But for people such as Moreira, the census is about more than number-crunching. For the Kalunga, descendants of slaves shipped to Brazil from places such as Angola, Mozambique and Ivory Coast, it is a chance, finally, to be counted, heard and helped by a government that has long ignored them.
"The federal government has to know that we exist – what we do, what we have," said Moreira, a 42-year-old subsistence farmer, who attributes recent improvements in his community, including the arrival of roads, electricity and a school, to Brazil's last head-count, in 2000. "Before, we were totally forgotten. Now equality is coming through the census and the interviews."
"It is a question of identity," said Ivonete Carvalho, the government's programme director for traditional communities. "When you assert your identity you are saying you want [government] action and access to public policies. [The census] is a fantastic x-ray."
The Kalungas' fight for recognition is part of a wider movement for racial equality in Brazil, a country with deep roots in Africa but where Afro-Brazilian politicians and business leaders remain few and far between. According to Carvalho, only one of Brazil's 81 senators is black, despite the fact that Afro-Brazilians represent at least 53% of the population. The last census found that fewer than 40% of Afro-Brazilians had access to sanitation compared with nearly 63% of whites.
Just as descendents of Brazil's runaway slaves are finding their voice – and telling the census takers about it – so too are Brazil's officially black and indigenous communities swelling as a growing number of Brazilians label themselves "black" or "indigenous" rather than "mulatto" when the census takers come knocking.
"People are no longer scared of identifying themselves or insecure about saying: 'I'm black, and black is beautiful,' " Brazil's minister for racial equality, Elio Ferreira de Araujo, told the Guardian.
For the first time in Brazilian history, this year's census will map out the different indigenous languages spoken in Brazil and register the number of same-sex relationships. It will also ask people their "ethnicity" – a thorny issue in a country that has long regarded itself as a racial melting pot and the rainbow nation of the Americas.
Since president Luiz Inácio Lula da Silva came to power in 2003, increasing steps have been taken to bridge the social chasm between Afro-Brazilians and their white counterparts. A ministry for racial equality has been created and university quotas introduced. The Brasil Quilombola programme, which aims to provide basic social services to thousands of slave descendants, has been rolled out across the country.
Engenho II, a village that is home to around 4,500 "Brazilian Kalungas" and was officially recognised by the government in 2009, has been one of the communities to benefit from the cause's new visibility.
"It was pretty calamitous here before," said Cerilo dos Santos Rosa, the territory's 56-year-old leader. "We didn't have roads, or energy. We'd have to take our produce to town on donkeys or on our backs."
The Kalungas also hope that their land will soon be formally demarcated by the government, with plans to offer compensation to landowners who leave the area, around 320km from Brazil's capital, Brasilia.
Not everybody is enthusiastic about the government's sudden engagement with quilombola communities. Some claim the arrival of brick houses, cash-transfer programmes and roads will irreparably damage their culture and create divisions between them and other communities. Others speculate that the government simply wants access to the abundant mineral resources buried under this sparsely populated savannah region.
Local people, however, are united in their praise for Lula's attempts to create what he calls a Brasil para todos – "Brazil for all".
"Lula has been a great example. He was the first president to visit our community," said Rosa, a father of 11 and grandfather of 29 who credits the president with building 40 brick homes and 93 toilets in the territory.
Government officials defend their attempts to offer "contemporary" life to some of the country's poorest, most isolated citizens.
"Cultural preservation has to be our objective … but giving quality of life to families that live in such remote places is also part of the mission," said Ferreira, the racial equality minister. "We have to value their culture but also the economic support that will give them social benefits."
Carvalho, herself born into a quilombola community in southern Brazil, said the government had finally started paying "an historical debt" to those whose forefathers were "wrenched from their motherland".
Brazil's excluded, she said, were increasingly willing to stand up and be counted. "I'm here. I'm me. I'm not ashamed of my history."
"The progress is slow but it is progress," said Moreira, sat beside his shack's rickety wooden door, bearing the chalked words: "God in first place."
"Before, the government didn't care if we existed or not. Today things are different. Today we all have to be registered. We have to appear. That's the only way things will get better."
• In 1872, when the first Brazilian census was conducted on the orders of Emperor Dom Pedro II, the population was divided into free people and slaves, who represented 15% of the population.
• Just 1.8% of the 1872 population were considered "rich" – 23,400 families. In 2000 that figure had risen only slightly to about 2.4%.
• The following census, in 1890, found that 83% of over-fives were illiterate. By 2000 this had fallen to 17%.
• Brazil's population has more than doubled in 50 years, from 71 million in 1960 to more than 190 million today.
• 734,000 Brazilians identified themselves as "indigenous" in the 2000 census.
• This year, more than 7,000 data centres will compile information from about 225,000 PDAs.