Given an array where each indices represent a day and elements of array represent price of stocks on previous day.Prince decided to buy a stock and then sell that stock to earn maximum profit.Your task is to find out maximum profit which he can earn.
Input Format:
Line 1 : Integer N(Size of array)
Line 2 : N integers which are elements of array
Constraints:
1≤N≤106
1≤a[i]≤106
Output Format:
Integer(max profit)