#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100000 + 10;
const long long INF = numeric_limits<long long>::max();
enum { EVEN, ODD };
int A[MAXN];
long long dp[2][MAXN];
int main() {
  int N;
  cin >> N;
  for (int i = 1; i <= N; ++i) cin >> A[i];
  dp[ODD][1] = dp[EVEN][1] = dp[ODD][2] = -INF;
  dp[EVEN][2] = abs(A[2] - A[1]);
  long long ans = dp[EVEN][2];
  for (int i = 3; i <= N; ++i) {
    dp[ODD][i] = dp[EVEN][i - 1] - abs(A[i] - A[i - 1]);
    dp[EVEN][i] =
        max(dp[ODD][i - 1] + abs(A[i] - A[i - 1]), abs(A[i] - A[i - 1]) * 1ll);
    ans = max(ans, max(dp[ODD][i], dp[EVEN][i]));
  }
  cout << ans << endl;
  return 0;
}
