#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long n = 0, ans = 0;
  cin >> n;
  vector<long long> a(n), f1(n), f2(n);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    if (i) {
      f1[i] = abs(a[i] - a[i - 1]) * pow(-1, i + 1);
      f2[i] = -f1[i];
    }
  }
  ans = f1[1];
  long long cur = f1[1];
  int l = 1;
  for (int i = 2; i < n; i++) {
    cur += f1[i];
    while (l <= i && cur < 0) cur -= f1[l++];
    ans = max(ans, cur);
  }
  if (n > 2) {
    cur = f2[2];
    ans = max(ans, cur);
    l = 2;
    for (int i = 3; i < n; i++) {
      cur += f2[i];
      while (l <= i && cur < 0) cur -= f2[l++];
      ans = max(ans, cur);
    }
  }
  cout << ans;
  return 0;
}
