#include <bits/stdc++.h>
#pragma GCC optimize(2)
using namespace std;
const int INF = 1e9 + 7;
const int N = 2e5 + 7;
const int M = 1e6 + 7;
long long a[N], b[N];
long long dp[N][2];
signed main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    if (i > 1) b[i - 1] = abs(a[i] - a[i - 1]);
  }
  for (int i = 1; i <= n; i++) {
    dp[i][0] = max(dp[i - 1][1] + b[i], b[i]);
    dp[i][1] = max(dp[i - 1][0] - b[i], 0ll);
  }
  long long ans = 0;
  for (int i = 1; i < n; i++) ans = max(ans, max(dp[i][0], dp[i][1]));
  cout << ans << endl;
  return 0;
}
