7 to 11 year olds

Maria has a bag of candy. At school, she gives half of it to her classmates. In the park she gives to her frends half of the candies left. When she gots home, her brother Jorge keeps half of what is left in the bag. Then Maria realizes that she has three candies left. How many candies did Maria’s bag have at the beginning?

Taken from: https://pasemosunrato.compematic.com/​