#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int N;
  cin >> N;
  int m = 0;
  vector<int> a(N);
  for (int i = 0; i < N; i++) cin >> a[i];
  for (int i = 1; i < N; i++) {
    m = a[i] - a[i - 1];
  }
  cout << m << endl;
  return 0;
}
