#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
long long getBrute(vector<long long> &a) {
  long long n = a.size();
  long long ans = -INF;
  for (long long l = 0; l < n; l++) {
    long long cur = 0;
    for (long long r = l + 1; r < n; r++) {
      if ((r - l) % 2 == 1) {
        cur += abs(a[r] - a[r - 1]);
      } else {
        cur -= abs(a[r] - a[r - 1]);
      }
      ans = max(ans, cur);
    }
  }
  return ans;
}
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
long long random(long long a, long long b) {
  return uniform_int_distribution<long long>(a, b)(rng);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n;
  cin >> n;
  vector<long long> dif(n - 1, 0);
  vector<long long> a(n);
  for (long long i = 0; i < (long long)n; i++) {
    cin >> a[i];
  }
  reverse(a.begin(), a.end());
  for (int i = 1; i < n; i++) {
    dif[i - 1] = abs(a[i] - a[i - 1]);
  }
  vector<long long> pref(n - 1, 0);
  for (int i = 0; i < n - 1; i++) {
    if (i < 2) {
      pref[i] = dif[i];
    } else {
      pref[i] = pref[i - 2] + dif[i];
    }
  }
  vector<long long> f(n - 1, 0);
  vector<long long> minF(2, 0);
  long long ans = dif[0];
  for (int i = 1; i < n - 1; i++) {
    f[i] = pref[i] - pref[i - 1];
    ans = max(ans, f[i] - minF[i % 2]);
    ans = max(ans, dif[i]);
    if (i >= 2) {
      minF[(i - 1) % 2] = min(minF[(i - 1) % 2], f[i - 1] - dif[i - 1]);
    }
  }
  cout << ans << "\n";
  return 0;
}
