using System; using System.Collections.Generic; using System.Linq; using System.IO; using SB = System.Text.StringBuilder; //using System.Threading.Tasks; //using System.Text.RegularExpressions; //using System.Globalization; //using System.Diagnostics; using static System.Console; using System.Numerics; using static System.Math; using pair = Pair; class Program { static void Main() { //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false }); new Program().solve(); Out.Flush(); } readonly Scanner cin = new Scanner(); readonly int[] dd = { 0, 1, 0, -1, 0 }; //→↓←↑ readonly int mod = 1000000007; readonly int dom = 998244353; bool chmax(ref T a, T b) where T : IComparable { if (a.CompareTo(b) < 0) { a = b; return true; } return false; } bool chmin(ref T a, T b) where T : IComparable { if (b.CompareTo(a) < 0) { a = b; return true; } return false; } struct data { public int x, y, z; public data(int x, int y, int z) { this.x = x; this.y = y; this.z = z; } } void solve() { int N = cin.nextint; eratos(N); var P = new[] { new data(2,2,2), new data(2,7,3), new data(7,2,3), new data(2,23,5), new data(23,2,5), new data(2,47,7), new data(47,2,7), new data(2,167,13), new data(167,2,13), new data(2,359,19), new data(359,2,19), new data(2,839,29), new data(839,2,29), new data(2,1367,37), new data(1367,2,37), new data(2,1847,43), new data(1847,2,43), new data(2,2207,47), new data(2207,2,47), new data(2,3719,61), new data(3719,2,61), new data(2,5039,71), new data(5039,2,71), new data(2,7919,89), new data(7919,2,89), new data(2,10607,103), new data(10607,2,103), new data(2,11447,107), new data(11447,2,107), new data(2,16127,127), new data(16127,2,127), new data(2,17159,131), new data(17159,2,131), new data(2,19319,139), new data(19319,2,139), new data(2,29927,173), new data(29927,2,173), new data(2,36479,191), new data(36479,2,191), new data(2,44519,211), new data(44519,2,211), new data(2,49727,223), new data(49727,2,223), new data(2,54287,233), new data(54287,2,233), new data(2,57119,239), new data(57119,2,239), new data(2,66047,257), new data(66047,2,257), new data(2,85847,293), new data(85847,2,293), new data(2,97967,313), new data(97967,2,313), new data(2,113567,337), new data(113567,2,337), new data(2,128879,359), new data(128879,2,359), new data(2,177239,421), new data(177239,2,421), new data(2,196247,443), new data(196247,2,443), new data(2,201599,449), new data(201599,2,449), new data(2,218087,467), new data(218087,2,467), new data(2,241079,491), new data(241079,2,491), new data(2,273527,523), new data(273527,2,523), new data(2,292679,541), new data(292679,2,541), new data(2,323759,569), new data(323759,2,569), new data(2,344567,587), new data(344567,2,587), new data(2,368447,607), new data(368447,2,607), new data(2,426407,653), new data(426407,2,653), new data(2,458327,677), new data(458327,2,677),}; //int cnt = 0; //foreach (var r in prime) //{ // long L = (long)r * r; // foreach (var p in prime) // { // if (p > L) // { // break; // } // if (L - p <= N && is_prime[L - p]) // { // WriteLine($"new data({p},{L - p},{r}),"); // } // } //} int cnt = 0; foreach (var item in P) { if (item.x <= N && item.y <= N && item.z <= N) { cnt++; } } WriteLine(cnt); } List prime; bool[] is_prime; void eratos(int n) { prime = new List(); is_prime = new bool[n + 1]; for (int i = 0; i <= n; i++) is_prime[i] = true; is_prime[0] = is_prime[1] = false; for (int i = 0; i <= n; i++) { if (is_prime[i]) { prime.Add(i); for (int j = 2 * i; j <= n; j += i) is_prime[j] = false; } } } int[] P; void phi(int n) { P = new int[n + 1]; for (int i = 0; i <= n; i++) P[i] = i; for (int i = 2; i <= n; i++) { if (is_prime[i]) { P[i] -= P[i] / i; for (int j = 2 * i; j <= n; j += i) P[j] -= P[j] / i; } } } } static class Ex { public static void join(this IEnumerable values, string sep = " ") => WriteLine(string.Join(sep, values)); public static string concat(this IEnumerable values) => string.Concat(values); public static string reverse(this string s) { var t = s.ToCharArray(); Array.Reverse(t); return t.concat(); } public static int lower_bound(this IList arr, T val) where T : IComparable { int low = 0, high = arr.Count; int mid; while (low < high) { mid = ((high - low) >> 1) + low; if (arr[mid].CompareTo(val) < 0) low = mid + 1; else high = mid; } return low; } public static int upper_bound(this IList arr, T val) where T : IComparable { int low = 0, high = arr.Count; int mid; while (low < high) { mid = ((high - low) >> 1) + low; if (arr[mid].CompareTo(val) <= 0) low = mid + 1; else high = mid; } return low; } } class Pair : IComparable> where T : IComparable where U : IComparable { public T f; public U s; public Pair(T f, U s) { this.f = f; this.s = s; } public int CompareTo(Pair a) => f.CompareTo(a.f) != 0 ? f.CompareTo(a.f) : s.CompareTo(a.s); public override string ToString() => $"{f} {s}"; } class Scanner { string[] s; int i; readonly char[] cs = new char[] { ' ' }; public Scanner() { s = new string[0]; i = 0; } public string[] scan => ReadLine().Split(); public int[] scanint => Array.ConvertAll(scan, int.Parse); public long[] scanlong => Array.ConvertAll(scan, long.Parse); public double[] scandouble => Array.ConvertAll(scan, double.Parse); public string next { get { if (i < s.Length) return s[i++]; string st = ReadLine(); while (st == "") st = ReadLine(); s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries); i = 0; return next; } } public int nextint => int.Parse(next); public long nextlong => long.Parse(next); public double nextdouble => double.Parse(next); }