Basically a math problem from wikipedia here.

```
class Solution(object):
def findDerangement(self, n):
"""
:type n: int
:rtype: int
"""
ans, a, b = 1, 1, 0
for i in range(2, n):
ans, a, b = i * (a+b) % 1000000007, i * (a+b) % 1000000007, a
return ans if n > 1 else 0
```