Two bags contain some numbers, and the total number of numbers is prime.

When we transfer the number 170 from bag 1 to bag 2, the average in both bags increases by one.

If the total sum of all numbers is 2004, find the total number of numbers.

Let's think step by step and output the final answer within \boxed{}.
user