Sub door_test()
Dim doorStatus(1 To 1000) As Integer
Dim student As Integer, doorNo As Integer, count As Integer
For student = 1 To 1000
For doorNo = 1 To 1000
If doorNo Mod student Then doorStatus(doorNo) = Not doorStatus(doorNo)
Next doorNo
Next student
For doorNo = 1 To 1000
If doorStatus(doorNo) Then count = count + 1
Next doorNo
MsgBox count
End Sub