The chef was busy in solving algebra, he found some interesting results, that there are many numbers which can be formed by the sum of the factorial of the digits, he wrote all those interesting numbers in the diary(in increasing order) and went to sleep. Cheffina came and stole his diary, in morning chef found that his diary is missing. Now the chef wants your help to find those numbers, Chef asks you whether N is that interesting number or not. If N is an interesting number then print 1. Else print 0. 

-----Input:-----
- First-line will contain $T$, the number of test cases. Then the test cases follow. 
- Each test case contains a single line of input, $N$. 

-----Output:-----
For each test case, output in a single line answer 1 or 0.

-----Constraints-----
- $1 \leq T \leq 10^6$
- $0 \leq N \leq 10^9$

-----Sample Input:-----
2
2
10

-----Sample Output:-----
1
0

-----EXPLANATION:-----
For 1) Factorial of 2 is 2, hence it is an interesting number.
For 2) conversion for 10 is 1! + 0! = 2, which is not equal to 10, hence not an interesting number.

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = 'from collections import Counter\r\nimport string\r\nimport math\r\nimport sys\r\n# sys.setrecursionlimit(10**6) \r\ndef isprime(x): \r\n      \r\n    # check for numbers from 2 \r\n    # to sqrt(x) if it is divisible \r\n    # return false \r\n    i = 2\r\n    while(i * i <= x): \r\n        if (x % i == 0): \r\n            return 0\r\n        i+=1\r\n    return 1\r\ndef isSumOfKprimes(N, K): \r\n      \r\n    # N < 2K directly return false \r\n    if (N < 2 * K): \r\n        return 0\r\n  \r\n    # If K = 1 return value depends \r\n    # on primality of N \r\n    if (K == 1): \r\n        return isprime(N) \r\n  \r\n    if (K == 2): \r\n          \r\n        # if N is even directly \r\n        # return true; \r\n        if (N % 2 == 0): \r\n            return 1\r\n  \r\n        # If N is odd, then one  \r\n        # prime must be 2. All  \r\n        # other primes are odd \r\n        # and cannot have a pair \r\n        # sum as even. \r\n        return isprime(N - 2)\r\n      \r\n  \r\n    # If K >= 3 return true; \r\n    return 1\r\nfrom fractions import Fraction\r\ndef array_int():\r\n    return [int(i) for i in sys.stdin.readline().split()]\r\ndef vary(arrber_of_variables):\r\n    if arrber_of_variables==1:\r\n        return int(sys.stdin.readline())\r\n    if arrber_of_variables>=2:\r\n        return list(map(int,sys.stdin.readline().split())) \r\ndef makedict(var):\r\n    return dict(Counter(var))\r\ntestcases=vary(1)\r\nfact=[1 for i in range(11)]\r\nfor i in range(1,10):\r\n    fact[i]=fact[i-1]*i\r\nfor _ in range(testcases):\r\n    n=vary(1)\r\n    p=n\r\n    ans=0\r\n    if n==0:\r\n        print(0)\r\n        continue\r\n    while n>0:\r\n        x=n%10\r\n        ans+=fact[x]\r\n        n//=10\r\n    if p==ans:\r\n        print(1)\r\n    else:\r\n        print(0)\r\n    \r\n        \r\n\r\n    \r\n    \r\n'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 14973