#!/bin/python3

import math
import os
import random
import re
import sys

#
# Complete the 'findDigits' function below.
#
# The function is expected to return an INTEGER.
# The function accepts INTEGER n as parameter.
#

def findDigits(n):
    # Write your code here
    divisor=0
    for i in list(str(n)):
        digit = int(i)
        if (digit==0):
            continue
        if n%digit == 0:
            divisor +=1
    return divisor

if __name__ == '__main__':
    fptr = open(os.environ['OUTPUT_PATH'], 'w')

    t = int(input().strip())

    for t_itr in range(t):
        n = int(input().strip())

        result = findDigits(n)

        fptr.write(str(result) + '\n')

    fptr.close()

b8ae8226e36061954244a480767a751bca448fe5
<mask token>

<mask token>


def findDigits(n):
    divisor = 0
    for i in list(str(n)):
        digit = int(i)
        if digit == 0:
            continue
        if n % digit == 0:
            divisor += 1
    return divisor


<mask token>

<mask token>


def findDigits(n):
    divisor = 0
    for i in list(str(n)):
        digit = int(i)
        if digit == 0:
            continue
        if n % digit == 0:
            divisor += 1
    return divisor


if __name__ == '__main__':
    fptr = open(os.environ['OUTPUT_PATH'], 'w')
    t = int(input().strip())
    for t_itr in range(t):
        n = int(input().strip())
        result = findDigits(n)
        fptr.write(str(result) + '\n')
    fptr.close()

import math
import os
import random
import re
import sys


def findDigits(n):
    divisor = 0
    for i in list(str(n)):
        digit = int(i)
        if digit == 0:
            continue
        if n % digit == 0:
            divisor += 1
    return divisor


if __name__ == '__main__':
    fptr = open(os.environ['OUTPUT_PATH'], 'w')
    t = int(input().strip())
    for t_itr in range(t):
        n = int(input().strip())
        result = findDigits(n)
        fptr.write(str(result) + '\n')
    fptr.close()

#!/bin/python3

import math
import os
import random
import re
import sys

#
# Complete the 'findDigits' function below.
#
# The function is expected to return an INTEGER.
# The function accepts INTEGER n as parameter.
#

def findDigits(n):
    # Write your code here
    divisor=0
    for i in list(str(n)):
        digit = int(i)
        if (digit==0):
            continue
        if n%digit == 0:
            divisor +=1
    return divisor

if __name__ == '__main__':
    fptr = open(os.environ['OUTPUT_PATH'], 'w')

    t = int(input().strip())

    for t_itr in range(t):
        n = int(input().strip())

        result = findDigits(n)

        fptr.write(str(result) + '\n')

    fptr.close()
