There are 500 coffins and 500 men who need them. The undertaker asks the first man to go to every coffin and open them. Then he tells the second man to go to every one and close it. The third one goes to every third coffin and so on. How many are open?