#include <bits/stdc++.h>
using namespace std;
long long int a[1000005];
long long int dp[1000005][2];
int main() {
  long long int n;
  scanf("%lld", &n);
  for (long long int i = 1; i <= (long long int)n; i++) scanf("%lld", a + i);
  dp[1][0] = abs(a[1] - a[1 + 1]);
  dp[1][1] = -abs(a[1] - a[1 + 1]);
  long long int ans = -1000000000000000LL;
  for (long long int i = 2; i <= (long long int)n - 1; i++) {
    dp[i][0] = max(abs(a[i] - a[i + 1]), dp[i - 1][1] + abs(a[i] - a[i + 1]));
    dp[i][1] = max(-abs(a[i] - a[i + 1]), dp[i - 1][0] - abs(a[i] - a[i + 1]));
  }
  for (long long int i = 1; i <= (long long int)n - 1; i++)
    ans = max(ans, dp[i][0]);
  for (long long int i = 1; i <= (long long int)n - 1; i++)
    ans = max(ans, dp[i][1]);
  printf("%lld\n", ans);
  return 0;
}
