#include <bits/stdc++.h>
using namespace std;
long long MOD = 1e9 + 7;
long long MAX = 1e17;
int main() {
  ios_base::sync_with_stdio(0);
  ;
  int n;
  cin >> n;
  long long a[n], s[n];
  long long d[n - 1];
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    if (i) d[i - 1] = abs(a[i - 1] - a[i]);
  }
  long long dp[n - 1], dp2[n - 1];
  for (int i = 0; i < n - 1; ++i) {
    dp[i] = 0;
    dp2[i] = 0;
  }
  dp[n - 2] = d[n - 2];
  dp2[n - 2] = d[n - 2];
  long long ans = dp[n - 2];
  for (int i = n - 3; i > -1; i--) {
    dp[i] = d[i];
    dp2[i] = d[i];
    dp[i] += max(-dp2[i + 1], 0ll);
    dp2[i] += min(-dp[i + 1], 0ll);
    ans = max(ans, dp[i]);
  }
  cout << ans << "\n";
}
