Calculate Euler Characteristic