#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
bool iseven(long long int n) {
  if ((n & 1) == 0) return true;
  return false;
}
void print(long long int t) { cout << t; }
void print(int t) { cout << t; }
void print(string t) { cout << t; }
void print(char t) { cout << t; }
void print(double t) { cout << t; }
void print(long double t) { cout << t; }
template <class T, class V>
void print(pair<T, V> p);
template <class T>
void print(vector<T> v);
template <class T>
void print(set<T> v);
template <class T, class V>
void print(map<T, V> v);
template <class T>
void print(multiset<T> v);
template <class T, class V>
void print(pair<T, V> p) {
  cout << "{";
  print(p.first);
  cout << ",";
  print(p.second);
  cout << "}";
}
template <class T>
void print(vector<T> v) {
  cout << "[ ";
  for (T i : v) {
    print(i);
    cout << " ";
  }
  cout << "]";
}
template <class T>
void print(set<T> v) {
  cout << "[ ";
  for (T i : v) {
    print(i);
    cout << " ";
  }
  cout << "]";
}
template <class T>
void print(multiset<T> v) {
  cout << "[ ";
  for (T i : v) {
    print(i);
    cout << " ";
  }
  cout << "]";
}
template <class T, class V>
void print(map<T, V> v) {
  cout << "[ ";
  for (auto i : v) {
    print(i);
    cout << " ";
  }
  cout << "]";
}
const long long int maxn = 1e5 + 5;
long long int n;
vector<long long int> a(maxn);
long long int dp[maxn][2];
long long int calc(long long int ind, long long int parity, bool end) {
  if (end) {
    return 0;
  }
  if (ind == n) {
    return 0;
  }
  if (dp[ind][parity] != -1) {
    return dp[ind][parity];
  }
  long long int ans;
  if (parity == 0) {
    ans = abs(a[ind] - a[ind + 1]) + calc(ind + 1, 1 - parity, false);
  } else {
    ans = -abs(a[ind] - a[ind + 1]) + calc(ind + 1, 1 - parity, false);
  }
  if (parity == 0) {
    ans = max(ans, abs(a[ind] - a[ind + 1]) + calc(ind + 1, 1 - parity, true));
  } else {
    ans = max(ans, -abs(a[ind] - a[ind + 1]) + calc(ind + 1, 1 - parity, true));
  }
  return dp[ind][parity] = ans;
}
void solve() {
  cin >> n;
  for (long long int i = 1; i <= n; ++i) {
    cin >> a[i];
  }
  memset(dp, -1, sizeof(dp));
  long long int ans = 0;
  for (long long int i = 1; i < n; ++i) {
    ans = max(ans, calc(i, 0, 0));
    ans = max(ans, calc(i, 1, 0));
  }
  cout << ans << '\n';
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
  return 0;
}
