In the morning all the doors in the school are closed. The school is quite big: there are **N** doors. Then pupils start coming. It might be hard to believe, but all of them want to study! Also, there are exactly **N** children studying in this school, and they come one by one.

When these strange children pass by some doors they change their status (i.e. Open -> Closed, Closed -> Open). Each student has their number, and each i-th student alters the status of every i-th door. For example: when the first child comes to the schools, he changes every first door (he opens all of them). The second one changes the status of every second door (he closes some doors: the 2nd, the 4th and so on). Finally, when the last one – the n-th – comes to the school, he changes the status of each n-th door (there's only one such door, though).

You need to count how many doors are left opened after all the students have come.

Example:

![](http://i.imgur.com/IqlOi2q.png)

*Here you can see red squares – closed doors, green – opened ones.*

Input:

> n – the number of doors and students, n ∈ N, n ∈ [1, 100000]

Output:

> o – the number of opened doors, o ∈ N

--- 

```
doors(5)
```

Should return

```
2
```

Difficulty: introductory

Starter code:

def doors(n):
	

Solutions:
def doors(n):
    return int(n ** .5)

def doors(n):
    doors = [False] * n
    for i in range(0, n):
        for j in range(i, n, i + 1):
            doors[j] = not doors[j]
    return doors.count(True)

def doors(n):
    return int(n**0.5)

def doors(n):
    from math import sqrt
    return int(sqrt(n))

import math
def doors(n):
   return sum([1 for i in range(1, n+1) if (i**0.5).is_integer()])
    
            
        
            
    
        


n = 100000
li = [0] * n
store = []
for i in range(1,n):
    for j in range(i-1, n, i):
        li[j] ^= 1
    store.append(li)
doors=lambda n:store[n+1][:n].count(1)

import numpy as np

def doors(n):
    doors = np.zeros(n, dtype=int)
    for i in range(n):
        doors[i::i+1] ^= 1
    return sum(doors)

def doors(n):
    door_status = []
    for a in range(0,n):
        door_status.append(False)
    for a in range(0,n):
        for b in range(a,n,a+1):
            door_status[b] = not door_status[b]
    result = 0
    for a in range(0,n):
        if door_status[a] == True: result += 1
    return result

from math import floor, sqrt
def doors(n):
    return floor(sqrt(n))

def doors(n):
  allDoors = []
  for i in range(0, n):
    allDoors.append("closed")

  for kid in range(1, n+1):
    for door in range(kid-1, n, kid):
        if allDoors[door] == "closed":
          allDoors[door] = "open"
        else:
          allDoors[door] = "closed"

  count = 0
  for j in range(0, len(allDoors)):
    if allDoors[j] == "open":
      count+=1
  return count