#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  int b[n];
  b[0] = 0;
  for (int i = 1; i < n; i++) b[i] = abs(a[i] - a[i - 1]);
  long long int dp[n], dd[n];
  dp[0] = 0;
  dd[0] = 0;
  for (int i = 1; i < n; i++) {
    if (i % 2 == 1) {
      dp[i] = dp[i - 1] + b[i];
      dd[i] = max(dd[i - 1] - b[i], 0LL);
    } else {
      dp[i] = max(0LL, dp[i - 1] - b[i]);
      dd[i] = dd[i - 1] + b[i];
    }
  }
  long long int ans = 0;
  for (int i = 0; i < n; i++) ans = max(ans, dp[i]);
  for (int i = 0; i < n; i++) ans = max(ans, dd[i]);
  cout << ans << endl;
}
