#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
const int MOD = 1e9 + 7;
long long dp[N][2][2];
int arr[N];
int n;
long long solve(int idx, bool take, int sign) {
  if (idx == n) return 0;
  long long& cur = dp[idx][take][sign + 1];
  if (cur != -1) return cur;
  if (take) {
    return cur = max(0ll, ((long long)(arr[idx] * sign)) +
                              solve(idx + 1, take, sign * -1));
  } else {
    return cur = max(solve(idx + 1, take, sign),
                     arr[idx] + solve(idx + 1, 1, -1));
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  memset(dp, -1, sizeof(dp));
  int num;
  cin >> n >> num;
  --n;
  for (int i = 0; i < n; ++i) {
    int cur;
    cin >> cur;
    arr[i] = abs(cur - num);
    num = cur;
  }
  cout << solve(0, 0, 0);
  return 0;
}
