#include <iostream> using namespace std; int main() { int n = 0; cin >> n; int prices[n]; for (int i = 0; i < n && cin >> prices[i]; i++); int max = 0; int money = 0; int min = prices[0]; for (int i = 1; i < n; i++) { money = prices[i] - min; if (money > max) { max = money; } if (money < 0) { min = prices[i]; } } cout << max; return 0; }