public int solution(int[] A) {
        if(A == null || A.length < 2) return 0;
        int even = 0, odd = 0, res = 0;
        
        for(int i = 0; i < A.length; i++) {
            if(A[i] % 2 == 0) even++;
            else odd++;
        }
        
        if(even > 0) res = even * (even - 1) / 2;
        if(odd > 0) res += odd * (odd - 1) / 2;
        
        return res;
	}