// yukicoder: No.537 ユーザーID // 2019.4.19 bal4u #include #include // 数値のハッシュ関数 #define HASHSIZ 2000081 long long hash[HASHSIZ+5], *hashend = hash+HASHSIZ; int insert(long long n) { long long *p = hash + n % HASHSIZ; while (*p) { if (*p == n) return 0; if (++p == hashend) p = hash; } *p = n; return 1; } long long tbl[15]; long long keta10(long long x) { int m, l = 0, r = 13; while (l < r) { m = (l + r) >> 1; if (tbl[m] <= x) l = m + 1; else r = m; } return tbl[l]; } int main() { int i, b, ans; long long N; N = 1; for (i = 0; i <= 13; i++) tbl[i] = N, N *= 10; scanf("%lld", &N); if (N == 1) { puts("1"); return 0; } ans = insert(N*10+1)+insert(keta10(N)+N); b = (int)sqrt((double)N); for (i = 2; i <= b; i++) { if (N % i == 0) { long long k = N / i; ans += insert(i*keta10(k) + k); ans += insert(k*keta10(i) + i); } } printf("%d\n", ans); return 0; }