2. Petya came up with a four-digit number, in which all the digits are different. It is known that the sum of the first three digits of this number is divisible by 9 and the sum of the last three digits of this number is divisible by 9. What values can the sum of all the digits of this number take? Find all possible values and explain why there are no others.