#include <bits/stdc++.h>
using namespace std;
template <class T>
void debug(T a, T b) {
  ;
}
int N;
long long a[1000010], dp[2][1000010];
int v[1000010];
long long f(int p, int q) {
  if (p >= N) return 0;
  if (dp[q == v[p]][p] != -1) return dp[q == v[p]][p];
  dp[0][p] = max(f(p + 1, 0), f(p + 1, 1));
  dp[1][p] = max(f(p + 1, v[p]) + a[p], dp[0][p]);
  return dp[q == v[p]][p];
}
int main() {
  ios_base::sync_with_stdio(false);
  memset(dp, -1, sizeof dp);
  long long t, t2;
  cin >> N >> t;
  --N;
  for (int i = 0; i < (N); ++i) {
    cin >> t2;
    a[i] = abs(t - t2);
    v[i] = t >= t2 ? 1 : 0;
    t = t2;
  }
  cout << f(0, v[0]) << endl;
  return 0;
}
