#include <bits/stdc++.h>
using namespace std;
const bool print = false;
const int MAXN = 1000111;
long long dp[MAXN][2];
long long t[MAXN];
long long ab(long long x) { return x > 0 ? x : -x; }
int main() {
  int n;
  scanf("%d", &n);
  for (int i = (1); i <= (n); i++) scanf("%lld", &t[i]);
  long long wyn = 0;
  for (int i = (n - 1); i >= (1); i--) {
    dp[i][0] = max(dp[i][0], dp[i + 1][1] + ab(t[i + 1] - t[i]));
    dp[i][1] = max(dp[i][1], dp[i + 1][0] - ab(t[i + 1] - t[i]));
    wyn = max(wyn, dp[i][0]);
  }
  printf("%lld\n", wyn);
}
