#include <bits/stdc++.h>
using namespace std;
int n;
long long a[100005], s[100005];
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
  }
  for (int i = 1; i < n; i++) {
    s[i] = abs(a[i] - a[i + 1]);
  }
  for (int i = 1; i < n; i++) {
    if (i % 2) s[i] = -s[i];
  }
  a[0] = 0;
  for (int i = 1; i < n; i++) a[i] = a[i - 1] + s[i];
  a[n] = 0;
  sort(a + 1, a + n + 1);
  cout << (a[n] - a[1]) << endl;
}
