Peter is a secret spy working against the Soviet Union. In order to fund his work, he creates a simple algorithm that will predict, with 100% accuracy, the future price of any stock in the world. To maximize the profits, he needs to figure out which stock to invest in. Can you help him?
The first line of input contains an integer \(N\). \((2 \le N \le 10^6)\)
The next N lines of input contains a single integer \(C_i\), the price of the stock at day \(i\). \((0 \le C_i \le 10^7)\)
Output, in one line, an integer representing the maximum amount of profit that could be made from trading the stock in question.
If no profit can be made, output
Peter can buy this stock when it is valued at \(1\), and sell this stock when it is valued at \(9\), generating a profit of \((9-1)\)