#include <bits/stdc++.h>
using namespace std;
long long int arr[200005];
pair<long long int, long long int> even[200005];
pair<long long int, long long int> odd[200005];
int main() {
  long long int n;
  cin >> n;
  for (long long int i = 1; i <= n; i++) cin >> arr[i];
  even[2] = make_pair(0, 2);
  odd[2] = make_pair(abs(arr[2] - arr[1]), 1);
  for (long long int i = 3; i <= n; i++) {
    long long int preve = even[i - 1].first;
    long long int prevel = even[i - 1].second;
    long long int prevo = odd[i - 1].first;
    long long int prevol = odd[i - 1].second;
    if (i % 2 == 0) {
      odd[i] = make_pair(prevo + abs(arr[i] - arr[i - 1]), prevol);
      if (preve - abs(arr[i] - arr[i - 1]) <= 0)
        even[i] = make_pair(0, i);
      else
        even[i] = make_pair(preve - abs(arr[i] - arr[i - 1]), prevel);
    } else {
      even[i] = make_pair(preve + abs(arr[i] - arr[i - 1]), prevel);
      if (prevo - abs(arr[i] - arr[i - 1]) <= 0)
        odd[i] = make_pair(0, i);
      else
        odd[i] = make_pair(prevo - abs(arr[i] - arr[i - 1]), prevol);
    }
  }
  long long int m = 0;
  for (long long int i = 1; i <= n; i++) {
    m = max(m, max(even[i].first, odd[i].first));
  }
  cout << m << endl;
}
