#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int a[N], n;
long long pre[2], suf[2], sum[2];
long long divide(int L, int R) {
  if (L == R) {
    pre[0] = -a[L];
    pre[1] = a[L];
    return a[L];
  }
  int M = (L + R) / 2;
  long long aa = divide(L, M);
  long long bb = divide(M + 1, R);
  long long ans = max(aa, bb);
  int cur = 0;
  suf[0] = suf[1] = 0;
  for (int i = M; i >= L; --i) {
    suf[(i - L) % 2] += a[i];
    suf[(i - L + 1) % 2] -= a[i];
    ans = max(ans, suf[(i - L) % 2] + pre[(M - i) % 2]);
  }
  pre[0] = pre[1] = LLONG_MIN;
  sum[0] = sum[1] = 0;
  for (int i = L; i <= R; ++i) {
    for (int j = 0; j < 2; ++j) {
      int sign = (2 * ((j + i - L) % 2) - 1);
      sum[j] += sign * a[i];
      pre[j] = max(pre[j], sum[j]);
    }
  }
  return ans;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) scanf("%d", &a[i]);
  for (int i = 0; i < n - 1; ++i) a[i] = abs(a[i] - a[i + 1]);
  cout << divide(0, n - 2) << '\n';
}
