#include <bits/stdc++.h>
using namespace std;
const long long int linf = (long long)9e18;
const int dx[8] = {0, 0, 1, -1, 1, -1, 1, -1},
          dy[8] = {1, -1, 0, 0, 1, -1, -1, 1};
const int MX = 2e5 + 5;
long long n, arr[MX], dp[MX][3][2], vis[MX][3][2];
long long solve(int idx, int state, int l) {
  if (idx == n) {
    if (state) return 0;
    return -2e9;
  }
  long long &ret = dp[idx][state][l];
  if (vis[idx][state][l] != -1) return ret;
  long long ch1 = -2e9, ch2 = -2e9, ch3 = -2e9;
  if (!state) {
    ch1 = solve(idx + 1, state, l);
    if (idx + 1 < n)
      ch2 = solve(idx + 1, state + 1, (idx + 1) % 2) +
            abs(arr[idx] - arr[idx + 1]);
  } else if (state == 1) {
    if (idx + 1 < n) {
      int mul = 1;
      if ((l - (idx + 1)) % 2) mul = -1;
      ch1 = solve(idx + 1, state, l) + (abs(arr[idx] - arr[idx + 1]) * mul);
      ch2 = solve(idx + 1, state + 1, l) + (abs(arr[idx] - arr[idx + 1]) * mul);
    }
    ch3 = solve(idx + 1, state + 1, l);
  } else
    ch1 = solve(idx + 1, state, l);
  vis[idx][state][l]++;
  return ret = max({ch1, ch2, ch3});
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  memset(vis, -1, sizeof vis);
  cin >> n;
  for (int i = 0; i < n; i++) cin >> arr[i];
  cout << solve(0, 0, 0) << endl;
  return 0;
}
