A highschool has a strange principal. on the first day of school he does something weird. There are 1000 lockers and 1000 students. He tells the first student to open every first locker. The second student to open every second locker, and if it is open, to close it. He tells the third student to open every third locker, and if it is open, to close it. He does this until all the students have done it. How many lockers are open at the end?