1. 

/**
* 10784 - Diagonal
*
* Studiengruppe: IFB2C
*
* Robert Reichart
* Elvin Uzeirovic
* Martin Pesl
*
* Run Time Submission Date
* 0.250 2009-04-30 21:56:26
*/

import java.io.*;
import java.util.Scanner;

class Main{
public static void main(String... args)throws IOException{
BufferedReader is= new BufferedReader(new InputStreamReader(System.in));
long wert = 0;
long count =0;
boolean first=true;


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

if (line!=null && !line.equals("")){
if (line.equals("0")){break;}
wert=Long.parseLong(line);
count++;
long result =(long)(Math.ceil((-1*-3 + Math.sqrt((-3*-3 - 4*1*-2*wert))) / 2*1));

System.out.println("Case " + count + ": " + result);


}
}
}
}