#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long n;
  cin >> n;
  long long a[n];
  for (long long i = 0; i < n; i++) cin >> a[i];
  long long f[n - 1];
  long long s[n - 1];
  for (long long i = 0; i < n - 1; i++) {
    f[i] = abs((a[i] - a[i + 1])) * pow(-1, i);
    s[i] = abs((a[i] - a[i + 1])) * (pow(-1, i + 1));
  }
  long long curr = f[0];
  long long max_sofar = f[0];
  for (long long i = 1; i <= n - 2; i++) {
    curr = max(f[i], curr + f[i]);
    max_sofar = max(max_sofar, curr);
  }
  if (n > 2) curr = s[1];
  max_sofar = max(max_sofar, curr);
  for (long long i = 2; i <= n - 2; i++) {
    curr = max(s[i], curr + s[i]);
    max_sofar = max(max_sofar, curr);
  }
  cout << max_sofar;
  return 0;
}
