WA for CHEFB(Chef and Easy problem 2)

Can someone please tell me why my solution is giving WA for subtask 3? My code http://www.codechef.com/viewsolution/4918838
In my solution in the inner loop all the nos. are divided by a prime no. (as long as a particular no. is divisible) and a maxcount is maintained, the outer loop iterates over all the prime nos. <=1000. After this the array elements are either 1 or a prime no.>1000. Then I have counted the no. of such distinct prime nos. and added to the answer.

//