Given that Mary has 2 bags of sweets. each of which contains same number of sweets.
Let us assume each bag contains x number of sweets.
After eating 4 sweets, total number of sweets left in two bags = x+x-4=2x-4
But given 2x-4 = 30
2x-4+4 = 30+4
2x=34

Hence there are 17 sweets in each bag at starting.