import java.util.*;
class Example implements Comparable
{
int x;
Example(){}
Example(int x){this.x = x;}
public int compareTo(Object obj)
{
Example e = (Example)obj;
return e.x - this.x;
}
public String toString()
{
return ""+x;
}
}
class AddingCustomObjects
{
public static void main(String[] args)
{
TreeSet ts = new TreeSet();
ts.add(new Example());
ts.add(new Example(20));
ts.add(new Example());
ts.add(new Example(5));
ts.add(new Example(30));
ts.add(new Example(20));
ts.add(new Example());
System.out.println(ts.size());
System.out.println(ts);
}
}