use std::io::{Read, stdin}; fn main() { let mut buf = String::new(); stdin().read_to_string(&mut buf).unwrap(); let mut tok = buf.split_whitespace(); let mut get = || tok.next().unwrap(); macro_rules! get { ($t:ty) => (get().parse::<$t>().unwrap()); () => (get!(usize)); } let n = get!(); let mut qs = vec![]; let mut flag = vec![false; n * 3 + 1]; for i in 2..flag.len() { if flag[i] { continue; } if i <= n { qs.push(i); } for j in 2..flag.len() { let k = i * j; if k >= flag.len() { break; } flag[k] = true; } } let mut ans = 0_i64; for i in 1..qs.len() { for j in i+1..qs.len() { for k in j+1..qs.len() { if !flag[qs[i]+qs[j]+qs[k]] { ans += 1; } } } } println!("{}", ans); }