
// 2002 WCU Computer Science High School Programming Contest
// Solution to Problem Two, Copyright 2005, all rights reserved
// Mark Holliday
// Western Carolina University
// Department of Mathematics and Computer Science
import java.io.*;
import java.util.*;

public class DegreeInversion
{
    private static final int NUM_ELTS = 4;

    public static void main(String[] args)
    {
        int i, j;
        int count;
        int[] array = new int[NUM_ELTS]; 
        BufferedReader br = null;
        
        try {
                br = new BufferedReader(new InputStreamReader(
                        System.in)); 
            } catch (Exception e) {}
    
            System.out.println("Please enter the array values: ");
        StringTokenizer line = new StringTokenizer("");
            try {
                line = new StringTokenizer(br.readLine());
            } catch (Exception e) {}
        for (i = 0; i < NUM_ELTS; i++) 
            array[i] = Integer.parseInt(line.nextToken());

        count = 0;
        for (i = 0; i < NUM_ELTS; i++)
            for (j = i; j < NUM_ELTS; j++)
                if (array[i] > array[j])
                        count++;
        System.out.println("The degree of inversion is: " + count);
    }

}
