Given an integer N, the task is to find out the count of numbers M that satisfy the condition M + sum(M) + sum** **(sum(M)) = N**,** where sum(M) denotes the sum of digits in M.

**Input:**

The first line of input contains an integer T denoting the number of test cases. Then T test cases follow. Each test case contains a number N as input.

**Output:**

For each test case, print the count of numbers in new line.

**Constraints:**

1<=T<=500

1<=N<=10^{9}

**Example:**

**Input:**

2

5

9

**Output:**

0

1

**Explanation:**

```
Input: 9
Output: 1
Explanation:
Only 1 positive integer satisfies the condition that is 3,
3 + sum(3) + sum(sum(3)) = 3 + 3 + 3 = 9
```

Author: arun03

If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.

SashaV | 220 |

VivSisMMM | 216 |

GustavoMéndez | 210 |

GHJKL | 196 |

d_Coder00 | 189 |

Pulkit__Sharma__ | 742 |

Anirban166 | 677 |

Found_me | 598 |

abducodes | 590 |

Sathvik Avasarala | 518 |

blackshadows | 5331 |

Ibrahim Nash | 5219 |

akhayrutdinov | 5111 |

mb1973 | 4929 |

Quandray | 4559 |

Login to report an issue on this page.