#include <bits/stdc++.h>
using namespace std;
void solve();
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(0);
  solve();
  return 0;
}
long long maxA = LONG_MIN, max_ending_here = 0, maxB = LONG_MIN, sumA = 0,
          sumB = 0;
bool A = 0, B = 0;
void solve() {
  int n;
  cin >> n;
  vector<long long> v(n), a(n), b(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  for (int i = 0; i < n - 1; i++) {
    a[i] = abs(v[i] - v[i + 1]);
    b[i] = a[i];
  }
  a[n - 1] = b[n - 1] = v[n - 1];
  for (int i = 0; i < n; i++) {
    if (i % 2 == 0) {
      a[i] *= (-1);
    } else {
      b[i] *= (-1);
    }
  }
  for (int i = 0; i < n - 1; i++) {
    max_ending_here = max_ending_here + a[i];
    if (maxA < max_ending_here) {
      maxA = max_ending_here;
    }
    if (max_ending_here < 0) {
      max_ending_here = 0;
    }
  }
  max_ending_here = 0;
  for (int i = 0; i < n - 1; i++) {
    max_ending_here = max_ending_here + b[i];
    if (maxB < max_ending_here) {
      maxB = max_ending_here;
    }
    if (max_ending_here < 0) {
      max_ending_here = 0;
    }
  }
  cout << (1ll) * max(maxA, maxB);
}
