public class Test {

    public static Object OneAtATime = new Object();
    public static int count = 0;

    static public void main(String A[]) {
        Thread t1=new Thread(new Task1());
        Thread t2=new Thread(new Task2());
        t1.start();
        t2.start();
        
        try {
            t1.join();
            t2.join();
            System.out.println(count);
        } catch (Exception e) {
            System.out.println("Abnormal termination: "+e);            
        }
    }
}

class Task1 implements Runnable {
    public void run() {
        for (int i=0; i<10000000; i++) {
            synchronized(Test.OneAtATime) {
                Test.count++;
            }
        }
    }
}

class Task2 implements Runnable {
    public void run() {
        for (int i=0; i<10000000; i++) {
            synchronized(Test.OneAtATime) {
                Test.count--;
            }
        }
    }
}