#include <bits/stdc++.h>
using namespace std;
int a[100005];
long long dp[100005][2];
const long long inf = 1e16;
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  dp[1][0] = abs(a[1] - a[2]);
  dp[1][1] = -inf;
  long long l = dp[1][1], r = dp[1][0];
  long long ans = dp[1][0];
  for (int i = 2; i < n; i++) {
    dp[i][0] = abs(a[i] - a[i + 1]);
    dp[i][1] = r - abs(a[i] - a[i + 1]);
    dp[i][0] = max(dp[i][0], dp[i][0] + l);
    r = dp[i][0];
    l = dp[i][1];
    ans = max(dp[i][0], ans);
    ans = max(dp[i][1], ans);
  }
  cout << ans << endl;
}
