fn main() { let n: u64 = get::val(); if n%2 == 1 || n == 0 {println!("0"); return} let fs = prime::factorize(n); let odd = fs.iter().filter(|&&x|x%2==1).count() as u64; println!("{}", (n+1) - 2 - (odd*2)) } #[allow(dead_code)] mod prime { pub fn is_prime(n: usize) -> bool { let sq = (n as f64).sqrt().floor() as usize; let p = (2..sq+1).all(|d| n%d != 0); p } pub fn primes(n: usize) -> Vec { if n < 2 {return vec![]} let mut ps = vec![true; n+1]; ps[0] = false; ps[1] = false; for i in 2 .. n+1 { if ps[i] { for k in 2 .. n/i+1 { ps[i*k] = false; } } } ps.iter().enumerate().filter(|&(_,&p)|p).map(|(i,_)|i).collect() } pub fn factorize(n: u64) -> Vec { let sq = (n as f64).sqrt().floor() as u64; let mut fs = vec![]; let mut x = n; for d in 2 .. sq+1 { if x == 1 {break} while x > 1 && x % d == 0 { fs.push(d); x /= d; } } if x != 1 {fs.push(x)}; fs } } #[allow(dead_code)] mod modulo { pub const MOD: u64 = 1_000_000_007; pub fn plus(x: u64, y: u64) -> u64 { (x + y) % MOD } pub fn mul(x: u64, y: u64) -> u64 { (x * y) % MOD } pub fn pow(x: u64, n: u64) -> u64 { match n { 0 => 1, _ if n % 2 == 1 => mul(x, pow(x, n-1)), _ => { let q = pow(x, n>>1); mul(q, q) } } } } #[allow(dead_code)] mod get { use std::io::*; use std::str::*; pub fn val() -> T { let mut buf = String::new(); stdin().read_line(&mut buf).ok(); buf.trim().parse::().ok().unwrap() } pub fn vals(n: usize) -> Vec { let mut vec: Vec = vec![]; for _ in 0 .. n { vec.push(val()); } vec } pub fn tuple() -> (T1, T2) { let mut buf = String::new(); stdin().read_line(&mut buf).ok(); let mut it = buf.trim().split_whitespace(); let x = it.next().unwrap().parse::().ok().unwrap(); let y = it.next().unwrap().parse::().ok().unwrap(); (x, y) } pub fn tuples(n: usize) -> Vec<(T1, T2)> { let mut vec: Vec<(T1, T2)> = vec![]; for _ in 0 .. n { vec.push(tuple()); } vec } pub fn tuple3() -> (T1, T2, T3) { let mut buf = String::new(); stdin().read_line(&mut buf).ok(); let mut it = buf.trim().split_whitespace(); let x = it.next().unwrap().parse::().ok().unwrap(); let y = it.next().unwrap().parse::().ok().unwrap(); let z = it.next().unwrap().parse::().ok().unwrap(); (x, y, z) } pub fn tuple3s(n: usize) -> Vec<(T1, T2, T3)> { let mut vec: Vec<(T1, T2, T3)> = vec![]; for _ in 0 .. n { vec.push(tuple3()); } vec } pub fn list() -> Vec { let mut buf = String::new(); stdin().read_line(&mut buf).ok(); buf.trim().split_whitespace().map(|t| t.parse::().ok().unwrap()).collect() } pub fn lists(h: usize) -> Vec> { let mut mat: Vec> = vec![]; for _ in 0 .. h { mat.push(list()); } mat } pub fn chars() -> Vec { let mut buf = String::new(); stdin().read_line(&mut buf).ok(); buf.trim().chars().collect() } }