Let's say you have n elements in S. These elements would sum to some value A.
When you remove an element, you have n - 1 elements, and sum A - (element value).
You also know 2 values (1 and 2002) in S, so use those to get:
A - 1 mod (n-1) == 0 and A - 2002 mod (n-1) == 0.
So 2001 mod (n-1) == 0 , thus n - 1 is a factor of 2001.
The next thing to note is that every element of the set must be 1 mod (n-1) . Since we know A - 1 mod (n-1) == 0.
Do you see where to go knowing those two conditions? (1. n - 1 is a factor of 2001, and 2. every distinct positive integer element of S must be 1 mod (n-1))