#include <bits/stdc++.h>
using namespace std;
long long int n, a[100005], b[100005], dp[100005];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (long long int i = 1; i <= n; ++i) cin >> a[i];
  for (long long int i = 1; i <= n - 1; ++i) b[i] = abs(a[i] - a[i + 1]);
  n--;
  dp[n] = b[n];
  dp[n - 1] = max(b[n - 1], b[n - 1] - b[n]);
  long long int ans = max(dp[n], dp[n - 1]);
  for (long long int i = n - 2; i >= 1; i--) {
    dp[i] = max(b[i], b[i] - b[i + 1] + max(0LL, dp[i + 2]));
    ans = max(ans, dp[i]);
  }
  cout << ans << '\n';
}
