987654321 problem

Problem Description

For given number N you must output amount of N-digit numbers, such, that last digits of their square is equal to 987654321.

Input

Input contains integer number N (1<=N<=106)

Output

Write answer to the output.

Sample Input

8

Sample Output

0

Solution

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <bits/stdc++.h>

int main() {
std::ios::sync_with_stdio(false);

int n = 0;
std::cin >> n;
if(n <= 8) {
std::cout << 0 << std::endl;
} else if(n == 9) {
std::cout << 8 << std::endl;
} else {
std::cout << 72;
while(n---10) {
std::cout << "0";
}
std::cout << std::endl;
}

return 0;
}