1. 

/**
* FWP, Ausgewählte Probleme aus dem ACM Programming Contest, SS10
* Problem: 11063 B2-Sequence
*
* @author Robert Reichart
* @version 2.0
*
* Status : Accepted
* Runtime: 0.220
*/

import java.util.*;

class Main{
public static void main(String... args){
Scanner in = new Scanner (System.in);
int u=0;
while(in.hasNextInt())
{
u++;
int elements = in.nextInt();
int[] values = new int[elements];
for (int i=0; i<elements;i++){
values[i]=in.nextInt();
}

boolean fail=false;
HashSet<Integer> sums = new HashSet<Integer>();
//paarweise summieren
for (int i=0; i<elements;i++){
for (int j=i; j<elements;j++){
if (i>=1){if (values[i]<values[i-1]){fail=true;}}
if (sums.contains(values[i]+values[j]) || values[i]<1)
{
fail=true;
break;
}
else
{
sums.add(values[i]+values[j]);
}
}
}
if (fail)
{
System.out.println("Case #" + u + ": It is not a B2-Sequence.\n");
}else{
System.out.println("Case #" + u + ": It is a B2-Sequence.\n");
}
}
}
}