1. JAVA, Peter Schnitzler

/* Problem : 106
* Author : Peter Schnitzler
* Status : AC
* Runtime : 1.06
*/

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.StringTokenizer;


public class Main
{


public static void main(String[] args) throws Exception
{
BufferedReader read = new BufferedReader(new InputStreamReader(System.in));


while(true)
{
String line = read.readLine();

//end of File
if (line == null)
{
break;
}
StringTokenizer tok = new StringTokenizer(line);

int next = Integer.parseInt(tok.nextToken());

//numeber that were used for any triple
boolean used [] = new boolean [next + 1];
used[0] = true;


int counter = 0;
int u = 2;
while (true)
{
int u2 = u * u;
if (u2 >= next)
{
break;
}


int v = 1;
while (true)
{
int v2 = v * v;

if (v >= u || u2 + v2 > next)
{
break;
}

if (euclid(u, v) == 1 && (((u & 1) == 0) || ((v & 1) == 0)))
//finding a primitive triple
{
counter++;

//calculate the triple
int x = u2 - v2;
int y = 2 * u * v;
int z = u2 + v2;

//calculating non-primitve triples
for (int count = 1; z*count <= next; count++)
{
used[x * count] = true;
used[y * count] = true;
used[z * count] = true;
}
}

v++;
}


u++;
}

//output
int notUsed = 0;

for (boolean b: used)
{
if (!b)
notUsed++;
}

System.out.println(counter + " " + notUsed);
}
}


private static int euclid (int a, int b)
{
if (b == 0)
return a;

return euclid (b, a % b);
}
}