/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
class Counter {
    private int count = 0;

    public void increment() {
        count++;  // Thread-safe increment
    }

    public int getCount() {
        return count;
    }
}
class Ideone
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Counter c= new Counter();
		Thread t1 = new Thread(new Runnable(){
			@Override
			public void run(){
				for(int i=0;i<1000;i++){
					c.increment();
				}
			}
		}
			);
		Thread t2 = new Thread(new Runnable(){
			@Override
			public void run(){
				for(int i=0;i<1000;i++){
					c.increment();
				}
			}
		}
			);
		t1.start();
		t2.start();
		
		t1.join();
		t2.join();
		System.out.println(c.getCount());
	}
}