#include <bits/stdc++.h>
using namespace std;
const int N = 100009;
const long long INF = 1e16;
int n, a[N];
long long s1[N], s2[N];
long long vout = -INF, t1[2], t2[2];
inline int read() {
  char c = getchar();
  int f = 1, ret = 0;
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c <= '9' && c >= '0') {
    ret = ret * 10 + c - '0';
    c = getchar();
  }
  return ret * f;
}
int main() {
  n = read();
  t1[1] = t2[1] = INF;
  for (int i = 1; i <= n; i++) a[i] = read();
  for (int i = 1; i < n; i++)
    s1[i] = abs(a[i] - a[i + 1]) * (((i - 1) & 1) ? -1 : 1);
  for (int i = 1; i < n; i++) s2[i] = abs(a[i] - a[i + 1]) * ((i & 1) ? -1 : 1);
  for (int i = 1; i < n; i++) s1[i] += s1[i - 1], s2[i] += s2[i - 1];
  for (int i = 1, t; t = (i & 1), i < n; i++) {
    vout = max(vout, (i & 1) ? s1[i] - t1[t ^ 1] : s2[i] - t2[t ^ 1]);
    vout = max(vout, (i & 1) ? s2[i] - t2[t] : s1[i] - t1[t]);
    t1[t] = min(t1[t], s1[i]);
    t2[t] = min(t2[t], s2[i]);
  }
  printf("%lld\n", vout);
  return 0;
}
