Divided into 9 parts, there are 3 left, that is, after removing 3 parts, when the unit number is 1, it is a multiple of 9.
When the unit number is 1, the number that is a multiple of 9 is 90x+8 1(x is an integer).
Divide it into eight, and there are two left. When x=3,
270+8 1+3=354 satisfies the condition (352 is divisible by 8).
So there are 354 pieces of sugar.