#include <bits/stdc++.h>
using namespace std;
long long dp[100005][3][3][3];
bool vis[100005][3][3][3];
long long arr[100005];
int n;
long long best(int i, int st, int prev, int seq) {
  if (st > 1) return 0;
  if (i == n) return 0;
  long long& ret = dp[i][st][prev][seq];
  if (vis[i][st][prev][seq] != 0) return ret;
  vis[i][st][prev][seq] = 1;
  ret = best(i, st + 1, st == 0, 0);
  if (st && prev && i > 0)
    ret = max(ret, best(i + 1, st, 1, !seq) +
                       abs(arr[i] - arr[i - 1]) * -1 * (seq == 0 ? -1 : 1));
  else if (st)
    ret = max(ret, best(i + 1, st, 1, seq));
  else
    ret = max(ret, best(i + 1, 0, 0, 0));
  return ret;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  memset(dp, -1, sizeof(dp));
  memset(vis, 0, sizeof(vis));
  cout << best(0, 0, 0, 0);
}
