#include <bits/stdc++.h>
using namespace std;
const int OO = (int)2e9 + 5;
const int MOD = (int)1e9 + 7;
const long double Pi = 3.141592653589793238;
const int N = (int)2e5 + 5;
long long qqaGJJ[N], ss[2][N], vRI[2][N], n, uVyh = 0;
int main() {
  cin >> n;
  for (int i = (int)(1); i <= (int)(n); i++) cin >> qqaGJJ[i];
  reverse(qqaGJJ + 1, qqaGJJ + n + 1);
  for (int i = (int)(1); i <= (int)(n); i++) {
    if (i == 1) {
      ss[0][i] = ss[1][0] = 0;
      vRI[0][i] = vRI[1][i] = 0;
    } else {
      for (int k = (int)(0); k <= (int)(1); k++) {
        ss[k][i] = ss[k][i - 1] +
                   abs(qqaGJJ[i] - qqaGJJ[i - 1]) * (((i + k) % 2) ? 1 : -1);
        vRI[k][i] = min(vRI[k][i - 1], ss[k][i]);
      }
    }
  }
  uVyh = ss[1][2];
  for (int i = (int)(2); i <= (int)(n); i++) {
    uVyh = max(uVyh, ss[(i + 1) % 2][i] - vRI[(i + 1) % 2][i - 1]);
  }
  cout << uVyh;
}
