// poly_arrays0

class A { 
    public int getVal() { return 1;} 
}
class B extends A { 
    public int getVal() { return 1+super.getVal(); }
}
class C extends A { 
    public int getVal() { return 1+super.getVal(); }
}


public class poly_arrays0 {
    public static void main(String[] args) {

	A[] x = new A[4];
	x[0] = new A(); // 1
	x[1] = new B(); // 2
	x[2] = new B(); // 2
	x[3] = new C(); // 2
	
	int sum = 0;
	for (int i=0; i<x.length; i++)
	    sum+=x[i].getVal();
	System.out.println(sum);
    }
}

// output: 7 (hooray!)
