#include <bits/stdc++.h>
using namespace std;
const double pi = 3.1415926535;
const int MI = 2147483647;
const int mod = 1e9 + 7;
const int Max = 2e5 + 25;
long long a[Max];
long long dp[Max][2];
int main() {
  cin.sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  long long MAX = -MI;
  for (int i = 2; i <= n; i++) {
    dp[i][0] = max(dp[i - 1][1], 0ll) + abs(a[i] - a[i - 1]);
    dp[i][1] = max(dp[i - 1][0], 0ll) - abs(a[i] - a[i - 1]);
    MAX = max(max(dp[i][0], dp[i][1]), MAX);
  }
  cout << MAX << endl;
}
