import java.util.*;


public class Solution {

    public int getDis (int[] A, int n) {
        // write code here
        int max = 0;
        int a = 0;

        for (int i = 1; i < n; i++){
            if (A[i] - A[a] > max){
                max = A[i] - A[a];
            }
            if (A[i] < A[a]){
                a = i;
            }
        }

        return max;
    }
    
}