#include <bits/stdc++.h>
using namespace std;
//#define int long long
#define repi(a, i, n) for( int i = a ; i < n ; i++)
#define repj(a, j, n) for( int j = a ; j < n ; j++)
#define rrep(a, i, n) for( int i = n ; i >= a; i--)
#define mp make_pair
#define pb push_back
#define S second
#define F first
#define inf 0x3f
#define MAX 1000001
#define teste cout << "testando **********\n"
#define ll  long long
#define ld  long double
#define mod 1000000007LL
typedef  vector<int> vi;
typedef  vector<double> vd;
typedef pair<int, int> pii;
typedef  pair<double, double> pdd;
typedef  pair< int, double> pid;
typedef  pair< double, int> pdi;
typedef map<int, int> mii;
ll abss(ll a, ll b){
    ll ans = a - b;
    if( ans < 0)
        return -ans;
    return ans;
}

void kadane(vector<ll> &v, ll &n, ll &max_total){
 ll max_atual, menos_max_atual;
 max_atual = menos_max_atual = 0;
 max_total = -11111111111111;
 for(ll i=0;i<n-1;i++){
        ll ans=(i&1LL)?-1:1;
        max_atual = max_atual + abss( v[i], v[i+1])*ans;
        menos_max_atual = menos_max_atual + abss( v[i], v[i+1])*(-ans);
        if(max_atual < 0){
            max_atual = 0;
        }
        if(menos_max_atual < 0)
            menos_max_atual=0;
        if(max_atual > max_total){
            max_total = max_atual;
        }
        if(menos_max_atual > max_total){
            max_total = menos_max_atual;
        }
 }
}
int main(){
 ios_base::sync_with_stdio(false);
 ll n, ma;
 cin >> n;
 vector<ll>v(n);
 repi(0,i,n)cin>>v[i];
 kadane(v,n,ma);
 cout << ma << endl;
 return 0;
}


#include <bits/stdc++.h>
using namespace std;
//#define int long long
#define repi(a, i, n) for( int i = a ; i < n ; i++)
#define repj(a, j, n) for( int j = a ; j < n ; j++)
#define rrep(a, i, n) for( int i = n ; i >= a; i--)
#define mp make_pair
#define pb push_back
#define S second
#define F first
#define inf 0x3f
#define MAX 1000001
#define teste cout << "testando **********\n"
#define ll  long long
#define ld  long double
#define mod 1000000007LL
typedef  vector<int> vi;
typedef  vector<double> vd;
typedef pair<int, int> pii;
typedef  pair<double, double> pdd;
typedef  pair< int, double> pid;
typedef  pair< double, int> pdi;
typedef map<int, int> mii;
ll abss(ll a, ll b){
    ll ans = a - b;
    if( ans < 0)
        return -ans;
    return ans;
}

void kadane(vector<ll> &v, ll &n, ll &max_total){
 ll max_atual, menos_max_atual;
 max_atual = menos_max_atual = 0;
 max_total = -11111111111111;
 for(ll i=0;i<n-1;i++){
        ll ans=(i&1LL)?-1:1;
        max_atual = max_atual + abss( v[i], v[i+1])*ans;
        menos_max_atual = menos_max_atual + abss( v[i], v[i+1])*(-ans);
        if(max_atual < 0){
            max_atual = 0;
        }
        if(menos_max_atual < 0)
            menos_max_atual=0;
        if(max_atual > max_total){
            max_total = max_atual;
        }
        if(menos_max_atual > max_atual){
            max_total = menos_max_atual;
        }
 }
}
int main(){
 ll n, ma;
 cin >> n;
 vector<ll>v(n);
 repi(0,i,n)cin>>v[i];
 kadane(v,n,ma);
 cout << ma << endl;
 return 0;
}


#include <bits/stdc++.h>
using namespace std;
//#define int long long
#define repi(a, i, n) for( int i = a ; i < n ; i++)
#define repj(a, j, n) for( int j = a ; j < n ; j++)
#define rrep(a, i, n) for( int i = n ; i >= a; i--)
#define mp make_pair
#define pb push_back
#define S second
#define F first
#define inf 0x3f
#define MAX 1000001
#define teste cout << "testando **********\n"
#define ll  long long
#define ld  long double
#define mod 1000000007LL
typedef  vector<int> vi;
typedef  vector<double> vd;
typedef pair<int, int> pii;
typedef  pair<double, double> pdd;
typedef  pair< int, double> pid;
typedef  pair< double, int> pdi;
typedef map<int, int> mii;
ll abss(ll a, ll b){
    ll ans = a - b;
    if( ans < 0)
        return -ans;
    return ans;
}

void kadane(vector<ll> &v, ll &n, ll &max_total){
 ll max_atual;
 max_atual = 0;
 max_total = -11111111111111;
 for(ll i=0;i<n-1;i++){
        ll ans=(i&1LL)?-1:1;
        max_atual = max_atual + abss( v[i], v[i+1])*ans;
        if(max_atual < 0){
            max_atual = 0;
        }
        if(max_atual > max_total){
            max_total = max_atual;
        }
  }
}
int main(){
 ios_base::sync_with_stdio(false);
 ll n, ma;
 cin >> n;
 vector<ll>v(n);
 repi(0,i,n)cin>>v[i];
 kadane(v,n,ma);
 cout << ma << endl;
 return 0;
}


#include <bits/stdc++.h>
using namespace std;
//#define int long long
#define repi(a, i, n) for( int i = a ; i < n ; i++)
#define repj(a, j, n) for( int j = a ; j < n ; j++)
#define rrep(a, i, n) for( int i = n ; i >= a; i--)
#define mp make_pair
#define pb push_back
#define S second
#define F first
#define inf 0x3f
#define MAX 1000001
#define teste cout << "testando **********\n"
#define ll  long long
#define ld  long double
#define mod 1000000007LL
typedef  vector<int> vi;
typedef  vector<double> vd;
typedef pair<int, int> pii;
typedef  pair<double, double> pdd;
typedef  pair< int, double> pid;
typedef  pair< double, int> pdi;
typedef map<int, int> mii;
ll abss(ll a, ll b){
    ll ans = a - b;
    if( ans < 0)
        return -ans;
    return ans;
}

void kadane(vector<ll> &v, ll &n, ll &max_total){
 ll max_atual, menos_max_atual;
 max_atual = 0;
 max_total = menos_max_atual = -1000000000;
 for(ll i=0;i<n-1;i++){
        ll ans=(i&1LL)?-1:1;
        max_atual = max_atual + abss( v[i], v[i+1])*ans;
        menos_max_atual = menos_max_atual + abss( v[i], v[i+1])*(-ans);
        if(max_atual < 0){
            max_atual = 0;
        }
        if(menos_max_atual < 0)
            menos_max_atual=0;
        if(max_atual > max_total){
            max_total = max_atual;
        }
        if(menos_max_atual > max_atual){
            max_total = menos_max_atual;
        }
 }
}
int main(){
 ll n, ma;
 cin >> n;
 vector<ll>v(n);
 repi(0,i,n)cin>>v[i];
 kadane(v,n,ma);
 cout << ma << endl;
 return 0;
}


/*
************************************************
*           * KAMRUL HASAN TUSHER              *
*           * JAHANGIRNAGAR UNIVERSITY         *
*           * CSE-45                           *
************************************************
*/
#include <bits/stdc++.h>

using namespace std;

typedef     long long               ll;
typedef     unsigned long long      ull;
typedef     pair<int, int>          pii;
typedef     pair<ll, ll>            pll;
typedef     pair<double, double>    pdd;
typedef     vector<double>          vd;
typedef     vector<ll>              vl;
typedef     vector<int>             vi;
typedef     vector<pii>             vii;
typedef     vector<pll>             vll;
typedef     vector<char>            vcc;
typedef     vector<string>          vss;
typedef     queue<int>              qi;
typedef     queue<pii>              qii;
typedef     priority_queue<int>     PQ;
typedef     priority_queue<pii>     PQII;

#define     sc                scanf
#define     pf                printf
#define     NL                printf("\n")
#define     pb                push_back
#define     mk_pr             make_pair
#define     NIL               -1
#define     bug               pf("ok\n")
#define     VISITED           1
#define     UNVISITED         0
#define     PI                acos(-1.0)
#define     eps               0.0000001
#define     modulo            1000000007
#define     MX                262345
#define     INF               2123456789

#define     READ              freopen("INPUT.in", "r", stdin)
#define     WRITE             freopen("OUTPUT.out", "w", stdout)
#define     read              freopen("INPUT.txt", "r", stdin)
#define     write             freopen("OUTPUT.txt", "w", stdout)
#define     memst(arr, n, v)  for(int i=0; i<n; i++) arr[i] = v
#define     FasterIO          ios_base :: sync_with_stdio(false); cin.tie(0);

/*.................................................................................*/

ll ar[MX];

int main() {
        ///write;
        ///FasterIO
        ll n, i;
        sc("%lld", &n);
        for(i=1; i<=n; i++) {
                sc("%lld", &ar[i]);
        }
        ll mx = INT_MIN, f = 0, f1 = 0, l = 1;
        for(i=1; i<n; i++) {
                ll ff = abs(ar[i] - ar[i+1]);
                if( (i-l)%2 != 0 ) ff *= -1;
                f += ff;
                mx = max(mx, f);
                if( f < 0 ) {
                        f = 0;
                        l = i+1;
                }
        }
        for(i=1; i<n; i++) {
                ll ff = abs(ar[i] - ar[i+1]);
                if( (i-l)%2 != 0 ) ff *= -1;
                f1 -= ff;
                mx = max(mx, abs(f1));
                if( f1 > 0 ) {
                        f1 = 0;
                        l = i+1;
                }
        }
        pf("%lld\n", mx);

        return 0;
}


/*
************************************************
*           * KAMRUL HASAN TUSHER              *
*           * JAHANGIRNAGAR UNIVERSITY         *
*           * CSE-45                           *
************************************************
*/
#include <bits/stdc++.h>

using namespace std;

typedef     long long               ll;
typedef     unsigned long long      ull;
typedef     pair<int, int>          pii;
typedef     pair<ll, ll>            pll;
typedef     pair<double, double>    pdd;
typedef     vector<double>          vd;
typedef     vector<ll>              vl;
typedef     vector<int>             vi;
typedef     vector<pii>             vii;
typedef     vector<pll>             vll;
typedef     vector<char>            vcc;
typedef     vector<string>          vss;
typedef     queue<int>              qi;
typedef     queue<pii>              qii;
typedef     priority_queue<int>     PQ;
typedef     priority_queue<pii>     PQII;

#define     sc                scanf
#define     pf                printf
#define     NL                printf("\n")
#define     pb                push_back
#define     mk_pr             make_pair
#define     NIL               -1
#define     bug               pf("ok\n")
#define     VISITED           1
#define     UNVISITED         0
#define     PI                acos(-1.0)
#define     eps               0.0000001
#define     modulo            1000000007
#define     MX                262345
#define     INF               2123456789

#define     READ              freopen("INPUT.in", "r", stdin)
#define     WRITE             freopen("OUTPUT.out", "w", stdout)
#define     read              freopen("INPUT.txt", "r", stdin)
#define     write             freopen("OUTPUT.txt", "w", stdout)
#define     memst(arr, n, v)  for(int i=0; i<n; i++) arr[i] = v
#define     FasterIO          ios_base :: sync_with_stdio(false); cin.tie(0);

/*.................................................................................*/

ll ar[MX];

int main() {
        ///write;
        ///FasterIO
        ll n, i;
        sc("%lld", &n);
        for(i=1; i<=n; i++) {
                sc("%lld", &ar[i]);
        }
        ll mx = INT_MIN, f = 0, l = 1;
        for(i=1; i<n; i++) {
                ll ff = abs(ar[i] - ar[i+1]);
                if( (i-l)%2 != 0 ) ff *= -1;
                f += ff;
                mx = max(mx, f);
                if( f < 0 ) {
                        f = 0;
                        l = i+1;
                }
        }
        pf("%lld\n", mx);

        return 0;
}


/*
************************************************
*           * KAMRUL HASAN TUSHER              *
*           * JAHANGIRNAGAR UNIVERSITY         *
*           * CSE-45                           *
************************************************
*/
#include <bits/stdc++.h>

using namespace std;

typedef     long long               ll;
typedef     unsigned long long      ull;
typedef     pair<int, int>          pii;
typedef     pair<ll, ll>            pll;
typedef     pair<double, double>    pdd;
typedef     vector<double>          vd;
typedef     vector<ll>              vl;
typedef     vector<int>             vi;
typedef     vector<pii>             vii;
typedef     vector<pll>             vll;
typedef     vector<char>            vcc;
typedef     vector<string>          vss;
typedef     queue<int>              qi;
typedef     queue<pii>              qii;
typedef     priority_queue<int>     PQ;
typedef     priority_queue<pii>     PQII;

#define     sc                scanf
#define     pf                printf
#define     NL                printf("\n")
#define     pb                push_back
#define     mk_pr             make_pair
#define     NIL               -1
#define     bug               pf("ok\n")
#define     VISITED           1
#define     UNVISITED         0
#define     PI                acos(-1.0)
#define     eps               0.0000001
#define     modulo            1000000007
#define     MX                262345
#define     INF               2123456789

#define     READ              freopen("INPUT.in", "r", stdin)
#define     WRITE             freopen("OUTPUT.out", "w", stdout)
#define     read              freopen("INPUT.txt", "r", stdin)
#define     write             freopen("OUTPUT.txt", "w", stdout)
#define     memst(arr, n, v)  for(int i=0; i<n; i++) arr[i] = v
#define     FasterIO          ios_base :: sync_with_stdio(false); cin.tie(0);

/*.................................................................................*/

ll ar[MX], dif[MX], dp1[MX], dp2[MX];

int main() {
        ///write;
        ///FasterIO
        ll n, i, j;
        sc("%lld", &n);
        for(i=1; i<=n; i++) {
                sc("%lld", &ar[i]);
        }
        for(i=1, j=1; i<n; i++) {
                dif[j] = abs(ar[i]-ar[i+1]);
                dp1[j] = dp2[j] = dif[j];
                if( j&1 ) dp2[j] *= -1;
                else dp1[j] *= -1;
                j++;
        }
        ll mx = 0, f = 0;
        for(i=1; i<=j; i++) {
                f += dp1[i];
                mx = max(mx, f);
                if( f < 0 ) f = 0;
        }
        for(i=1, f=0 ; i<=j; i++) {
                f += dp2[i];
                mx = max(mx, f);
                if( f < 0 ) f = 0;
        }
        pf("%lld\n", mx);

        return 0;
}


/*
************************************************
*           * KAMRUL HASAN TUSHER              *
*           * JAHANGIRNAGAR UNIVERSITY         *
*           * CSE-45                           *
************************************************
*/
#include <bits/stdc++.h>

using namespace std;

typedef     long long               ll;
typedef     unsigned long long      ull;
typedef     pair<int, int>          pii;
typedef     pair<ll, ll>            pll;
typedef     pair<double, double>    pdd;
typedef     vector<double>          vd;
typedef     vector<ll>              vl;
typedef     vector<int>             vi;
typedef     vector<pii>             vii;
typedef     vector<pll>             vll;
typedef     vector<char>            vcc;
typedef     vector<string>          vss;
typedef     queue<int>              qi;
typedef     queue<pii>              qii;
typedef     priority_queue<int>     PQ;
typedef     priority_queue<pii>     PQII;

#define     sc                scanf
#define     pf                printf
#define     NL                printf("\n")
#define     pb                push_back
#define     mk_pr             make_pair
#define     NIL               -1
#define     bug               pf("ok\n")
#define     VISITED           1
#define     UNVISITED         0
#define     PI                acos(-1.0)
#define     eps               0.0000001
#define     modulo            1000000007
#define     MX                262345
#define     INF               2123456789

#define     READ              freopen("INPUT.in", "r", stdin)
#define     WRITE             freopen("OUTPUT.out", "w", stdout)
#define     read              freopen("INPUT.txt", "r", stdin)
#define     write             freopen("OUTPUT.txt", "w", stdout)
#define     memst(arr, n, v)  for(int i=0; i<n; i++) arr[i] = v
#define     FasterIO          ios_base :: sync_with_stdio(false); cin.tie(0);

/*.................................................................................*/

int ar[MX];

int main() {
        ///write;
        ///FasterIO
        int n, i;
        sc("%d", &n);
        for(i=1; i<=n; i++) {
                sc("%d", &ar[i]);
        }
        int mx = INT_MIN, f = 0, l = 1;
        for(i=1; i<n; i++) {
                int ff = abs(ar[i] - ar[i+1]);
                if( (i-l)%2 != 0 ) ff *= -1;
                f += ff;
                mx = max(mx, f);
                if( f < 0 ) {
                        f = 0;
                        l = i+1;
                }
        }
        pf("%d\n", mx);

        return 0;
}


/*
************************************************
*           * KAMRUL HASAN TUSHER              *
*           * JAHANGIRNAGAR UNIVERSITY         *
*           * CSE-45                           *
************************************************
*/
#include <bits/stdc++.h>

using namespace std;

typedef     long long               ll;
typedef     unsigned long long      ull;
typedef     pair<int, int>          pii;
typedef     pair<ll, ll>            pll;
typedef     pair<double, double>    pdd;
typedef     vector<double>          vd;
typedef     vector<ll>              vl;
typedef     vector<int>             vi;
typedef     vector<pii>             vii;
typedef     vector<pll>             vll;
typedef     vector<char>            vcc;
typedef     vector<string>          vss;
typedef     queue<int>              qi;
typedef     queue<pii>              qii;
typedef     priority_queue<int>     PQ;
typedef     priority_queue<pii>     PQII;

#define     sc                scanf
#define     pf                printf
#define     NL                printf("\n")
#define     pb                push_back
#define     mk_pr             make_pair
#define     NIL               -1
#define     bug               pf("ok\n")
#define     VISITED           1
#define     UNVISITED         0
#define     PI                acos(-1.0)
#define     eps               0.0000001
#define     modulo            1000000007
#define     MX                262345
#define     INF               2123456789

#define     READ              freopen("INPUT.in", "r", stdin)
#define     WRITE             freopen("OUTPUT.out", "w", stdout)
#define     read              freopen("INPUT.txt", "r", stdin)
#define     write             freopen("OUTPUT.txt", "w", stdout)
#define     memst(arr, n, v)  for(int i=0; i<n; i++) arr[i] = v
#define     FasterIO          ios_base :: sync_with_stdio(false); cin.tie(0);

/*.................................................................................*/

ll ar[MX];

int main() {
        ///write;
        ///FasterIO
        ll n, i;
        sc("%lld", &n);
        for(i=1; i<=n; i++) {
                sc("%lld", &ar[i]);
        }
        ll mx = INT_MIN, f = 0, f1 = 0, l = 1;
        for(i=1; i<n; i++) {
                ll ff = abs(ar[i] - ar[i+1]);
                if( (i-l)%2 != 0 ) ff *= -1;
                f += ff;
                mx = max(mx, f);
                if( f < 0 ) {
                        f = 0;
                        l = i+1;
                }
        }
        for(i=1; i<n; i++) {
                ll ff = abs(ar[i] - ar[i+1]);
                if( (i-l)%2 != 0 ) ff *= -1;
                f1 += ff;
                mx = max(mx, abs(f1));
                if( f1 > 0 ) {
                        f1 = 0;
                        l = i+1;
                }
        }
        pf("%lld\n", mx);

        return 0;
}


/*
************************************************
*           * KAMRUL HASAN TUSHER              *
*           * JAHANGIRNAGAR UNIVERSITY         *
*           * CSE-45                           *
************************************************
*/
#include <bits/stdc++.h>

using namespace std;

typedef     long long               ll;
typedef     unsigned long long      ull;
typedef     pair<int, int>          pii;
typedef     pair<ll, ll>            pll;
typedef     pair<double, double>    pdd;
typedef     vector<double>          vd;
typedef     vector<ll>              vl;
typedef     vector<int>             vi;
typedef     vector<pii>             vii;
typedef     vector<pll>             vll;
typedef     vector<char>            vcc;
typedef     vector<string>          vss;
typedef     queue<int>              qi;
typedef     queue<pii>              qii;
typedef     priority_queue<int>     PQ;
typedef     priority_queue<pii>     PQII;

#define     sc                scanf
#define     pf                printf
#define     NL                printf("\n")
#define     pb                push_back
#define     mk_pr             make_pair
#define     NIL               -1
#define     bug               pf("ok\n")
#define     VISITED           1
#define     UNVISITED         0
#define     PI                acos(-1.0)
#define     eps               0.0000001
#define     modulo            1000000007
#define     MX                262345
#define     INF               2123456789

#define     READ              freopen("INPUT.in", "r", stdin)
#define     WRITE             freopen("OUTPUT.out", "w", stdout)
#define     read              freopen("INPUT.txt", "r", stdin)
#define     write             freopen("OUTPUT.txt", "w", stdout)
#define     memst(arr, n, v)  for(int i=0; i<n; i++) arr[i] = v
#define     FasterIO          ios_base :: sync_with_stdio(false); cin.tie(0);

/*.................................................................................*/

int ar[MX];

int main() {
        ///write;
        ///FasterIO
        int n, i;
        sc("%d", &n);
        for(i=1; i<=n; i++) {
                sc("%d", &ar[i]);
        }
        int mx = 0, f = 0, l = 1;
        for(i=1; i<n; i++) {
                int ff = abs(ar[i] - ar[i+1]);
                if( (i-l)%2 != 0 ) ff *= -1;
                f += ff;
                mx = max(mx, f);
                if( f < 0 ) {
                        f = 0;
                        l = i+1;
                }
        }
        pf("%d\n", mx);

        return 0;
}


#include <bits/stdc++.h>

#define ll long long
#define ld long double
using namespace std;

int main() {
    ll n;
    cin >> n;
    ll a[n+1];
    for (ll i = 1; i <= n; i++)
        cin >> a[i];
    if (n == 2)
    {
        cout << max(a[2],max(abs(a[2] - a[1]),a[1])) << endl;
        return 0;
    }
    ll b[n+1];
    n--;
    for (ll i = 1; i <= n; i++) {
        b[i] = abs(a[i + 1] - a[i]);
//        cout << b[i] << " ";
    }
//    cout << endl;
    ////
    ll p[n+1];
    p[1] = b[1];
    ll locan = p[1];
    for (ll i = 2; i <= n; i++)
    {
        if (i % 2 == 0)
        {
            p[i] = p[i-1] - b[i];
        }
        else
        {
            p[i] = max(p[i-1] + b[i],b[i]);
        }
        locan = max(locan,p[i]);
//        cout << p[i] << " ";
    }
//    cout << endl;
    ////
    ll pp[n+1];
    pp[2] = b[2];
    ll locan2 = pp[2];
    for (ll i = 3; i <= n; i++)
    {
        if (i % 2 != 0)
        {
            pp[i] = pp[i-1] - b[i];
        }
        else
        {
            pp[i] = max(pp[i-1] + b[i],b[i]);
        }
        locan2 = max(locan,pp[i]);
//        cout << pp[i] << " ";
    }
//    cout << endl;
    ///
    cout << max(locan,locan2) << endl;
    return 0;
}


#include <bits/stdc++.h>

#define ll long long
#define ld long double
using namespace std;

int main() {
    ll n;
    cin >> n;
    ll a[n+1];
    for (ll i = 1; i <= n; i++)
        cin >> a[i];
    if (n == 2)
    {
        cout << max((ll)0,abs(a[2] - a[1])) << endl;
        return 0;
    }
    ll b[n+1];
    n--;
    for (ll i = 1; i <= n; i++) {
        b[i] = abs(a[i + 1] - a[i]);
//        cout << b[i] << " ";
    }
//    cout << endl;
    ////
    ll p[n+1];
    p[1] = b[1];
    ll locan = p[1];
    for (ll i = 2; i <= n; i++)
    {
        if (i % 2 == 0)
        {
            p[i] = p[i-1] - b[i];
        }
        else
        {
            p[i] = max(p[i-1] + b[i],b[i]);
        }
        locan = max(locan,p[i]);
//        cout << p[i] << " ";
    }
//    cout << end/l;
    ////
    ll pp[n+1];
    pp[2] = b[2];
    ll locan2 = pp[2];
    for (ll i = 3; i <= n; i++)
    {
        if (i % 2 != 0)
        {
            pp[i] = pp[i-1] - b[i];
        }
        else
        {
            pp[i] = max(pp[i-1] + b[i],b[i]);
        }
        locan2 = max(locan,pp[i]);
//        cout << pp[i] << " ";
    }
//    cout << endl;
    ///
    cout << max(locan,locan2) << endl;
    return 0;
}


#include <bits/stdc++.h>

#define ll long long
#define ld long double
using namespace std;

int main() {
    ll n;
    cin >> n;
    ll a[n+1];
    for (ll i = 1; i <= n; i++)
        cin >> a[i];
    ll b[n+1];
    n--;
    for (ll i = 1; i <= n; i++)
        b[i] = abs(a[i+1] - a[i]);
    ////
    ll p[n+1];
    p[1] = b[1];
    ll locan = p[1];
    for (ll i = 2; i <= n; i++)
    {
        if (i % 2 == 0)
        {
            p[i] = max(p[i-1] - b[i],-b[i]);
        }
        else
        {
            p[i] = max(p[i-1] + b[i],b[i]);
        }
        locan = max(locan,p[i]);
    }
    ////
    ll pp[n+1];
    pp[2] = b[2];
    ll locan2 = p[2];
    for (ll i = 3; i <= n; i++)
    {
        if (i % 2 != 0)
        {
            pp[i] = max(pp[i-1] - b[i],-b[i]);
        }
        else
        {
            pp[i] = max(pp[i-1] + b[i],b[i]);
        }
        locan2 = max(locan,pp[i]);
    }
    ///
    cout << max(locan,locan2) << endl;
    return 0;
}


#include <bits/stdc++.h>

#define ll long long
#define ld long double
using namespace std;

int main() {
    ll n;
    cin >> n;
    ll a[n+1];
    for (ll i = 1; i <= n; i++)
        cin >> a[i];
    if (n == 2)
    {
        cout << max((ll)0,abs(a[2] - a[1])) << endl;
        return 0;
    }
    ll b[n+1];
    n--;
    for (ll i = 1; i <= n; i++) {
        b[i] = abs(a[i + 1] - a[i]);
//        cout << b[i] << " ";
    }
//    cout << endl;
    ////
    ll p[n+1];
    p[1] = b[1];
    ll locan = p[1];
    for (ll i = 2; i <= n; i++)
    {
        if (i % 2 == 0)
        {
            p[i] = p[i-1] - b[i];
        }
        else
        {
            p[i] = max(p[i-1] + b[i],b[i]);
        }
        locan = max(locan,p[i]);
//        cout << p[i] << " ";
    }
//    cout << endl;
    ////
    ll pp[n+1];
    pp[2] = b[2];
    ll locan2 = pp[2];
    for (ll i = 3; i <= n; i++)
    {
        if (i % 2 != 0)
        {
            pp[i] = pp[i-1] - b[i];
        }
        else
        {
            pp[i] = max(pp[i-1] + b[i],b[i]);
        }
        locan2 = max(locan2,pp[i]);
//        cout << pp[i] << " ";
    }
    cout << max(locan,locan2) << endl;
    return 0;
}


#include <bits/stdc++.h>

#define ll long long
#define ld long double
using namespace std;

int main() {
    ll n;
    cin >> n;
    ll a[n+1];
    for (ll i = 1; i <= n; i++)
        cin >> a[i];
    if (n == 2)
    {
        cout << abs(a[2] - a[1]) << endl;
        return 0;
    }
    ll b[n+1];
    n--;
    for (ll i = 1; i <= n; i++)
        b[i] = abs(a[i+1] - a[i]);
    ////
    ll p[n+1];
    p[1] = b[1];
    ll locan = p[1];
    for (ll i = 2; i <= n; i++)
    {
        if (i % 2 == 0)
        {
            p[i] = p[i-1] - b[i];
        }
        else
        {
            p[i] = max(p[i-1] + b[i],b[i]);
        }
        locan = max(locan,p[i]);
//        cout << p[i] << " ";
    }
//    cout << endl;
    ////
    ll pp[n+1];
    pp[2] = b[2];
    ll locan2 = pp[2];
    for (ll i = 3; i <= n; i++)
    {
        if (i % 2 != 0)
        {
            pp[i] = pp[i-1] - b[i];
        }
        else
        {
            pp[i] = max(pp[i-1] + b[i],b[i]);
        }
        locan2 = max(locan,pp[i]);
//        cout << pp[i] << " ";
    }
//    cout << endl;
    ///
    cout << max(locan,locan2) << endl;
    return 0;
}


#include <bits/stdc++.h>

#define ll long long
#define ld long double
using namespace std;

int main() {
    ll n;
    cin >> n;
    ll a[n+1];
    for (ll i = 1; i <= n; i++)
        cin >> a[i];
    ll b[n+1];
    n--;
    for (ll i = 1; i <= n; i++)
        b[i] = abs(a[i+1] - a[i]);
    ////
    ll p[n+1];
    p[1] = b[1];
    ll locan = p[1];
    for (ll i = 2; i <= n; i++)
    {
        if (i % 2 == 0)
        {
            p[i] = p[i-1] - b[i];
        }
        else
        {
            p[i] = max(p[i-1] + b[i],b[i]);
        }
        locan = max(locan,p[i]);
    }
    ////
    ll pp[n+1];
    pp[2] = b[2];
    ll locan2 = p[2];
    for (ll i = 3; i <= n; i++)
    {
        if (i % 2 != 0)
        {
            pp[i] = pp[i-1] - b[i];
        }
        else
        {
            pp[i] = max(pp[i-1] + b[i],b[i]);
        }
        locan2 = max(locan,pp[i]);
    }
    ///
    cout << max(locan,locan2) << endl;
    return 0;
}


#include <bits/stdc++.h>

#define ll long long
#define ld long double
using namespace std;

int main() {
    ll n;
    cin >> n;
    ll a[n+1];
    for (ll i = 1; i <= n; i++)
        cin >> a[i];
    if (n == 2)
    {
        cout << max((ll)0,abs(a[2] - a[1])) << endl;
        return 0;
    }
    ll b[n+1];
    n--;
    for (ll i = 1; i <= n; i++) {
        b[i] = abs(a[i + 1] - a[i]);
//        cout << b[i] << " ";
    }
//    cout << endl;
    ////
    ll p[n+1];
    p[1] = b[1];
    ll locan = p[1];
    for (ll i = 2; i <= n; i++)
    {
        if (i % 2 == 0)
        {
            p[i] = p[i-1] - b[i];
        }
        else
        {
            p[i] = max(p[i-1] + b[i],b[i]);
        }
        locan = max(locan,p[i]);
//        cout << p[i] << " ";
    }
//    cout << endl;
    ////
    ll pp[n+1];
    pp[2] = b[2];
    ll locan2 = pp[2];
    for (ll i = 3; i <= n; i++)
    {
        if (i % 2 != 0)
        {
            pp[i] = pp[i-1] - b[i];
        }
        else
        {
            pp[i] = max(pp[i-1] + b[i],b[i]);
        }
        locan2 = max(locan,pp[i]);
//        cout << pp[i] << " ";
    }
//    cout << endl;
    ///
    cout << max((ll)0,max(locan,locan2)) << endl;
    return 0;
}


#pragma comment(linker, "/STACK:1024000000,1024000000")
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <cmath>
#include <queue>
#include <vector>
#define LL long long
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define MAXN 100005
using namespace std;

int InArr[MAXN];
int Arr[MAXN];

int main()
{
	int n;

	while( cin >> n )
	{
		cin >> InArr[0] >> InArr[1];

		Arr[0] = abs( InArr[0] - InArr[1] );

		for( int i = 2; i < n; i++ )
		{
			cin >> InArr[i];
			Arr[i-1] = abs( InArr[i-1] - InArr[i] );
		}

		int Max = Arr[0];
		int Now = Arr[0];
		for( int i = 1; i < n-2; i++ )
		{
			if( Arr[i] > Arr[i+1] )
			{
				Now = Arr[i];
				if( Now > Max )
					Max = Now;
			}
			else
			{
				Now += Arr[i+1] - Arr[i];
				if( i+1 < n-1 )
					i++;
				if( Now > Max )
					Max = Now;
			}
		}

		cout << Max << endl;
	}

	return 0;
}


#pragma comment(linker, "/STACK:1024000000,1024000000")
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <cmath>
#include <queue>
#include <vector>
#define LL long long
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define MAXN 100005
using namespace std;

LL InArr[MAXN];
LL Arr[MAXN];

int main()
{
	int n;

	while( cin >> n )
	{
		cin >> InArr[0] >> InArr[1];

		Arr[0] = abs( InArr[0] - InArr[1] );

		for( int i = 2; i < n; i++ )
		{
			cin >> InArr[i];
			Arr[i-1] = abs( InArr[i-1] - InArr[i] );
		}

		LL Max = Arr[0];
		LL Now = Arr[0];
		for( int i = 1; i < n-2; i++ )
		{
			if( Arr[i] > Max )
				Max = Arr[i];
			if( Arr[i] > Arr[i+1] )
			{
				Now = Arr[i];
				if( Now > Max )
					Max = Now;
			}
			else
			{
				Now = max( Now + Arr[i+1] - Arr[i], Arr[i+1] );
				if( i+1 < n-2 )
				{
					i++;
				}
				if( Now > Max )
					Max = Now;
			}
		}
		if( Arr[n-2] > Max )
			Max = Arr[n-2];

		cout << Max << endl;
	}

	return 0;
}


#pragma comment(linker, "/STACK:1024000000,1024000000")
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <cmath>
#include <queue>
#include <vector>
#define LL long long
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define MAXN 100005
using namespace std;

LL InArr[MAXN];
LL Arr[MAXN];
LL Ans[MAXN];

int main()
{
	int n;

	while( cin >> n )
	{
		cin >> InArr[0] >> InArr[1];

		Arr[0] = abs( InArr[0] - InArr[1] );

		for( int i = 2; i < n; i++ )
		{
			cin >> InArr[i];
			Arr[i-1] = abs( InArr[i-1] - InArr[i] );
		}
		memset( Ans, 0, sizeof(Ans) );

		LL Max = Arr[0];
		for( int i = 1; i < n-1; i++ )
			if( Arr[i] > Max )
				Max = Arr[i];

		Ans[0] = Arr[0];
		for( int i = 1; i < n-2; i++ )
		{
			Ans[i] = max( Ans[i], Arr[i] );
			LL temp = max( Ans[i-1] + Arr[i+1] - Arr[i], Arr[i+1] );
			Ans[i] = max( Ans[i], temp );
			if( Ans[i] > Max )
				Max = Ans[i];
		}

		cout << Max << endl;
	}

	return 0;
}


#pragma comment(linker, "/STACK:1024000000,1024000000")
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <cmath>
#include <queue>
#include <vector>
#define LL long long
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define MAXN 100005
using namespace std;

LL InArr[MAXN];
LL Arr[MAXN];

int main()
{
	int n;

	while( cin >> n )
	{
		cin >> InArr[0] >> InArr[1];

		Arr[0] = abs( InArr[0] - InArr[1] );

		for( int i = 2; i < n; i++ )
		{
			cin >> InArr[i];
			Arr[i-1] = abs( InArr[i-1] - InArr[i] );
		}

		LL Max = Arr[0];
		for( int i = 1; i < n-1; i++ )
			if( Arr[i] > Max )
				Max = Arr[i];

		LL Now = Arr[0];
		for( int i = 1; i < n-2; i++ )
		{
			if( Arr[i] > Arr[i+1] )
			{
				Now = Arr[i];
				if( Now > Max )
					Max = Now;
			}
			else
			{
				Now = max( Now + Arr[i+1] - Arr[i], Arr[i+1] );
				if( i+1 < n-2 )
				{
					i++;
				}
				if( Now > Max )
					Max = Now;
			}
		}

		cout << Max << endl;
	}

	return 0;
}


#pragma comment(linker, "/STACK:1024000000,1024000000")
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <cmath>
#include <queue>
#include <vector>
#define LL long long
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define MAXN 100005
using namespace std;

LL InArr[MAXN];
LL Arr[MAXN];

int main()
{
	int n;

	while( cin >> n )
	{
		cin >> InArr[0] >> InArr[1];

		Arr[0] = abs( InArr[0] - InArr[1] );

		for( int i = 2; i < n; i++ )
		{
			cin >> InArr[i];
			Arr[i-1] = abs( InArr[i-1] - InArr[i] );
		}

		LL Max = Arr[0];
		LL Now = Arr[0];
		for( int i = 1; i < n-2; i++ )
		{
			if( Arr[i] > Arr[i+1] )
			{
				Now = Arr[i];
				if( Now > Max )
					Max = Now;
			}
			else
			{
				Now = max( Now + Arr[i+1] - Arr[i], Arr[i+1] );
				if( i+1 < n-1 )
				{
					i++;
				}
				if( Now > Max )
					Max = Now;
			}
		}

		cout << Max << endl;
	}

	return 0;
}


#pragma comment(linker, "/STACK:1024000000,1024000000")
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <cmath>
#include <queue>
#include <vector>
#define LL long long
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define MAXN 100005
using namespace std;

LL Ans1[MAXN];
LL Ans2[MAXN];
LL dp[MAXN];
LL Arr[MAXN];

int main()
{
	ios::sync_with_stdio(false);
	int n;

	while( cin >> n )
	{
		for( int i = 0; i < n; i++ )
			cin >> Arr[i];

		for( int i = 1; i < n; i++ )
		{
			if( i % 2 == 0 )
			{
				Ans1[i-1] = abs(Arr[i] - Arr[i-1]);
				Ans2[i-1] = -abs(Arr[i] - Arr[i-1]);
			}
			else
			{
				Ans1[i-1] = -abs(Arr[i] - Arr[i-1]);
				Ans2[i-1] = abs(Arr[i] - Arr[i-1]);
			}
		}

		memset( dp, 0, sizeof(dp) );
		dp[0] = Ans1[0];
		LL Max = dp[0];
		for( int i = 1; i < n-1; i++ )
		{
			dp[i] = max(Ans1[i], Ans1[i]+dp[i-1]);
			if( dp[i] > Max )
				Max = dp[i];
		}

		dp[0] = Ans2[0];
		Max = max( Max, dp[0] );
		for( int i = 1; i < n-1; i++ )
		{
			dp[i] = max(Ans2[i], Ans2[i]+dp[i-1]);
			if( dp[i] > Max )
				Max = dp[i];
		}

		cout << Max << endl;
	}

	return 0;
}


#pragma comment(linker, "/STACK:1024000000,1024000000")
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <cmath>
#include <queue>
#include <vector>
#define LL long long
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define MAXN 100005
using namespace std;

LL Ans1[MAXN];
LL Ans2[MAXN];
LL dp[MAXN];
LL Arr[MAXN];

int main()
{
	ios::sync_with_stdio(false);
	int n;

	while( cin >> n )
	{
		for( int i = 0; i < n; i++ )
			cin >> Arr[i];

		for( int i = 1; i < n; i++ )
		{
			if( i % 2 == 0 )
			{
				Ans1[i-1] = abs(Arr[i] - Arr[i-1]);
				Ans2[i-1] = -abs(Arr[i] - Arr[i-1]);
			}
			else
			{
				Ans1[i-1] = -abs(Arr[i] - Arr[i-1]);
				Ans2[i-1] = abs(Arr[i] - Arr[i-1]);
			}
		}

		LL Max = 0;
		memset( dp, 0, sizeof(dp) );
		dp[0] = Ans1[0];
		for( int i = 1; i < n-1; i++ )
		{
			dp[i] = max(Ans1[i], Ans1[i]+dp[i-1]);
			if( dp[i] > Max )
				Max = dp[i];
		}

		dp[0] = Ans2[0];
		for( int i = 1; i < n-1; i++ )
		{
			dp[i] = max(Ans2[i], Ans2[i]+dp[i-1]);
			if( dp[i] > Max )
				Max = dp[i];
		}

		cout << Max << endl;
	}

	return 0;
}


#pragma comment(linker, "/STACK:1024000000,1024000000")
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <cmath>
#include <queue>
#include <vector>
#define LL long long
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define MAXN 100005
using namespace std;

int InArr[MAXN];
int Arr[MAXN];

int main()
{
	int n;

	while( cin >> n )
	{
		cin >> InArr[0] >> InArr[1];

		Arr[0] = abs( InArr[0] - InArr[1] );

		for( int i = 2; i < n; i++ )
		{
			cin >> InArr[i];
			Arr[i-1] = abs( InArr[i-1] - InArr[i] );
		}

		int Max = Arr[0];
		int Now = Arr[0];
		for( int i = 1; i < n-2; i++ )
		{
			if( Arr[i] > Arr[i+1] )
			{
				Now = Arr[i];
				if( Now > Max )
					Max = Now;
			}
			else
			{
				Now = max( Now + Arr[i+1] - Arr[i], Arr[i+1] );
				if( i+1 < n-1 )
				{
					i++;
				}
				if( Now > Max )
					Max = Now;
			}
		}

		cout << Max << endl;
	}

	return 0;
}


#pragma comment(linker, "/STACK:1024000000,1024000000")
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <cmath>
#include <queue>
#include <vector>
#define LL long long
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define MAXN 100005
using namespace std;

LL InArr[MAXN];
LL Arr[MAXN];

int main()
{
	int n;

	while( cin >> n )
	{
		cin >> InArr[0] >> InArr[1];

		Arr[0] = abs( InArr[0] - InArr[1] );

		for( int i = 2; i < n; i++ )
		{
			cin >> InArr[i];
			Arr[i-1] = abs( InArr[i-1] - InArr[i] );
		}

		LL Max = Arr[0];
		LL Now = Arr[0];
		for( int i = 1; i < n-2; i++ )
		{
			if( Arr[i] > Arr[i+1] )
			{
				Now = Arr[i];
				if( Now > Max )
					Max = Now;
			}
			else
			{
				Now = max( Now + Arr[i+1] - Arr[i], Arr[i+1] );
				if( i+1 < n-2 )
				{
					i++;
				}
				if( Now > Max )
					Max = Now;
			}
		}
		if( Arr[n-2] > Max )
			Max = Arr[n-2];

		cout << Max << endl;
	}

	return 0;
}


// BEGIN OF TEMPLATE //

// Inclusions:
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <memory.h>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <string.h>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>

// Namespaces:
using namespace std;

// Type definitions:
typedef const int cint;
typedef unsigned int uint;
typedef long long ll;
typedef const long long cll;
typedef unsigned long long ull;
typedef long double ld;
typedef const long double cld;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pld;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<vvvi> vvvvi;
typedef vector<bool> vb;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<string> vs;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
typedef vector<pld> vpld;
typedef set<int> si;
typedef set<ll> sll;
typedef set<ld> sld;
typedef set<string> ss;
typedef map<int, int> mi;
typedef map<ll, ll> mll;
typedef map<int, ll> mill;
typedef map<ll, int> mlli;
typedef map<int, string> mis;
typedef map<string, int> msi;

// Definitions:
#define EXTRA_MEMORY 3

#define FOR(i, s, f) for (decltype(s) (i) = (s); (i) < (f); ++(i))
#define ROF(i, f, s) for (decltype(s) (i) = (f) - 1; (i) >= (s); --(i))

#define forn(i, f) FOR((i), 0, (f))
#define rofn(i, f) ROF((i), (f), 0)

#define rep(i, s, f) FOR((i), (s), (f) + 1)
#define per(i, s, f) ROF((i), (f) + 1, (s))

#define forit(it, x) for (auto it = (x).begin(); it != (x).end(); ++it)

#define ALL(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())

#define PREF_TASK ""
#define SUFF_TASK ""

//   Scanning
/*
*  sc - scan
*  pr - print
*  i  - int
*  ll - long long
*  ld - long double (etc)
*  s  - safe (with extra memory)
*  d  - with declaration
*  v  - vector (vi - vector<int> etc)
*  nl - new line
*  n  - amount of elements
*  cl - clear
*  r  - relax
*/

//     Scanning for int
#define sci(a) scanf("%d", &(a))
#define sc2i(a, b) scanf("%d%d", &(a), &(b))
#define sc3i(a, b, c) scanf("%d%d%d", &(a), &(b), &(c))

#define scid(a) int (a); sci(a)
#define sc2id(a, b) int (a), (b); sc2i((a), (b))
#define sc3id(a, b, c) int (a), (b), (c); sc3i((a), (b), (c))

#define scvi(a) forn(IT_FOR_SCANNING, sz(a)) sci((a)[IT_FOR_SCANNING])
#define scvin(a, n) forn(IT_FOR_SCANNING, (n)) sci((a)[IT_FOR_SCANNING])
#define scvind(a, n) vi a(n); scvin((a), (n))
#define scvinds(a, n) vi a((n) + EXTRA_MEMORY); scvin((a), (n))

#define sc2vi(a) forn(IT_FOR_SCANNING, min(sz(a), sz(b))) sc2i((a)[IT_FOR_SCANNING], (b)[IT_FOR_SCANNING])
#define sc2vin(a, b, n) forn(IT_FOR_SCANNING, (n)) sc2i((a)[IT_FOR_SCANNING], (b)[IT_FOR_SCANNING])
#define sc2vind(a, b, n) vi a(n), b(n); sc2vin((a), (b), (n))
#define sc2vinds(a, b, n) vi a((n) + EXTRA_MEMORY), b((n) + EXTRA_MEMORY); sc2vin((a), (b), (n))

#define scsin(a, n) forn(IT_FOR_INSERTION, (n)) (a).insert(next_int())
#define scsind(a, n) si (a); scsin(a, n)

//     Scanning for ll
#define scll(a) scanf("%lld", &(a))
#define sc2ll(a, b) scanf("%lld%lld", &(a), &(b))
#define sc3ll(a, b, c) scanf("%lld%lld%lld", &(a), &(b), &(c))

#define sclld(a) ll (a); scll(a)
#define sc2lld(a, b) ll (a), (b); sc2ll((a), (b))
#define sc3lld(a, b, c) ll (a), (b), (c); sc3ll((a), (b), (c))

#define scvll(a) forn(IT_FOR_SCANNING, sz(a)) scll((a)[IT_FOR_SCANNING])
#define scvlln(a, n) forn(IT_FOR_SCANNING, (n)) scll((a)[IT_FOR_SCANNING])
#define scvllnd(a, n) vll a(n); scvlln((a), (n))
#define scvllnds(a, n) vll a((n) + EXTRA_MEMORY); scvlln((a), (n))

#define sc2vll(a) forn(IT_FOR_SCANNING, min(sz(a), sz(b))) sc2ll((a)[IT_FOR_SCANNING], (b)[IT_FOR_SCANNING])
#define sc2vlln(a, b, n) forn(IT_FOR_SCANNING, (n)) sc2ll((a)[IT_FOR_SCANNING], (b)[IT_FOR_SCANNING])
#define sc2vllnd(a, b, n) vll a(n), b(n); sc2vlln((a), (b), (n))
#define sc2vllnds(a, b, n) vll a((n) + EXTRA_MEMORY), b((n) + EXTRA_MEMORY); sc2vlln((a), (b), (n))

#define scslln(a, n) forn(IT_FOR_INSERTION, (n)) (a).insert(next_ll())
#define scsllnd(a, n) sll (a); scslln(a, n)

//   Printing
#define prnl printf("\n")

//     Printing for int
#define pri(a) printf("%d ", (a))
#define pr2i(a, b) printf("%d %d ", (a), (b))
#define pr3i(a, b, c) printf("%d %d %d ", (a), (b), (c))

#define prinl(a) printf("%d\n", (a))
#define pr2inl(a, b) printf("%d %d\n", (a), (b))
#define pr3inl(a, b, c) printf("%d %d %d\n", (a), (b), (c))

#define prvi(a) forn(IT_FOR_PRINTING, sz(a)) pri((a)[IT_FOR_PRINTING])
#define prvinl(a) forn(IT_FOR_PRINTING, sz(a)) prinl((a)[IT_FOR_PRINTING])
#define prvin(a, n) forn(IT_FOR_PRINTING, (n)) pri((a)[IT_FOR_PRINTING])
#define prvinnl(a, n) forn(IT_FOR_PRINTING, (n)) prinl((a)[IT_FOR_PRINTING])

//     Printing for ll
#define prll(a) printf("%lld ", (a))
#define pr2ll(a, b) printf("%lld %lld ", (a), (b))
#define pr3ll(a, b, c) printf("%lld %lld %lld ", (a), (b), (c))

#define prllnl(a) printf("%lld\n", (a))
#define pr2llnl(a, b) printf("%lld %lld\n", (a), (b))
#define pr3llnl(a, b, c) printf("%lld %lld %lld\n", (a), (b), (c))

#define prvll(a) forn(IT_FOR_PRINTING, sz(a)) prll((a)[IT_FOR_PRINTING])
#define prvllnl(a) forn(IT_FOR_PRINTING, sz(a)) prllnl((a)[IT_FOR_PRINTING])
#define prvlln(a, n) forn(IT_FOR_PRINTING, (n)) prll((a)[IT_FOR_PRINTING])
#define prvllnnl(a, n) forn(IT_FOR_PRINTING, (n)) prllnl((a)[IT_FOR_PRINTING])

//   Filling of arrays
#define FILL(a, x) memset((a), (x), sizeof(a))
#define FILLN(a, n, x) memset((a), (x), (n) * sizeof(*(a)))
#define cl(a) FILL((a), 0)
#define cln(a, n) FILLN((a), (n), 0)

//   Relaxing of min/max
#define rmin(a, b) (a) = min((a), (b))
#define rmax(a, b) (a) = max((a), (b))

//   MOD
#define modFix(a, MOD) ((((a) % (MOD)) + (MOD)) % (MOD))
#define modSum(a, b, MOD) modFix(((a) + (b)), (MOD))
/* Sub == Subtraction */
#define modSub(a, b, MOD) modFix(((a) - (b)), (MOD))
#define modMul(a, b, MOD) modFix(((ll)(a) * (ll)(b)), (MOD))

//   Fast IO
#define init_cin ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define cout_prec cout.precision(30)

// Templates and overloaded functions:
//   Relaxing min/max
template<class T, class U> inline void relax_min(T &a, U b) { a = min(a, b); }
template<class T, class U> inline void relax_max(T &a, U b) { a = max(a, b); }

template<typename T> inline bool updmax(T &a, const T &b){ return a < b ? a = b, 1 : 0; }
template<typename T> inline bool updmin(T &a, const T &b){ return a > b ? a = b, 1 : 0; }

//   Overloaded functions for stream input/output
template<class T, class U> istream &operator>>(istream &in, pair<T, U> &a)
{
    in >> a.first >> a.second;
    return in;
}

template<class T, class U> ostream &operator<<(ostream &out, const pair<T, U> &a)
{
    out << a.first << ' ' << a.second;
    return out;
}

template<class T> istream &operator>>(istream &in, vector<T> &a)
{
    forn(i, sz(a))
        in >> a[i];
    return in;
}

template<class T> ostream &operator<<(ostream &out, const vector<T> &a)
{
    forn(i, sz(a))
        out << a[i] << ' ';
    return out;
}

//   Instantaneous scanning
int next_int()
{
    scid(tmp);
    return tmp;
}

ll next_ll()
{
    sclld(tmp);
    return tmp;
}

//   MOD
ll modPow(ll a, ll b, ll MOD){
    ll ret = 1;
    for (; b; b >>= 1)
    {
        if (b & 1)
            ret = modMul(ret, a, MOD);
        a = modMul(a, a, MOD);
    }
    return ret;
}

// Constants:
//   Auxiliary constants
cll EXACTLY_ONE_HUNDRED = 100;
cll EXACTLY_ONE_THOUSAND = 1000;
cll EXACTLY_ONE_MILLION = 1000 * 1000;
cll EXACTLY_ONE_BILLION = EXACTLY_ONE_THOUSAND * EXACTLY_ONE_MILLION;

//   Size of array
cint MAXN1 = (int)(EXACTLY_ONE_HUNDRED * EXACTLY_ONE_THOUSAND) + EXTRA_MEMORY;
cint MAXN2 = (int)(2 * EXACTLY_ONE_HUNDRED * EXACTLY_ONE_THOUSAND) + EXTRA_MEMORY;
cint MAXN3 = (int)(3 * EXACTLY_ONE_HUNDRED * EXACTLY_ONE_THOUSAND) + EXTRA_MEMORY;
cint MAXN4 = (int)(4 * EXACTLY_ONE_HUNDRED * EXACTLY_ONE_THOUSAND) + EXTRA_MEMORY;
cint MAXN5 = (int)(5 * EXACTLY_ONE_HUNDRED * EXACTLY_ONE_THOUSAND) + EXTRA_MEMORY;
cint MAXN = MAXN3;

//   Infinities
/* 2 - 2^... */
cint INF = (int)EXACTLY_ONE_BILLION + 7;
cint INF2 = 1 << 30;
cll INFLL = EXACTLY_ONE_BILLION * EXACTLY_ONE_BILLION + 7;
cll INFLL2 = 1LL << 60;

//   Necessary constants
cld Pi = acos(-1.0);
cld EPS = 1e-7;

cint MOD = (int)EXACTLY_ONE_BILLION + 7;

// END OF TEMPLATE //

//#define FILEIO

//ll dp[MAXN][2];

int main()
{
#ifdef FILEIO
    ifstream in(PREF_TASK"in"SUFF_TASK);
    ofstream out(PREF_TASK"out"SUFF_TASK);
#endif

//    init_cin;

    scid(n);
    scvllnd(a, n);

    vector<vll> dp(n, vll(2, -INFLL));
//    forn(i, MAXN) {
//        forn(j, 2) {
//            dp[i][j] = -INFLL;
//        }
//    }

    ll ans = -INFLL;
    dp[0][0] = dp[0][1] = 0;
//    ans = dp[1][0] = llabs(a[1] - a[0]);
    FOR(i, 1, n) {   // for r
        forn(j, 2) {
            if ((i & 1) ^ (j & 1)) {
                updmax(dp[i][j], /*max(*/dp[i - 1][j] + llabs(a[i] - a[i - 1]));//, dp[i - 1][j ^ 1] - llabs(a[i] - a[i - 1])));
            } else {
                updmax(dp[i][j], /*max(*/dp[i - 1][j] - llabs(a[i] - a[i - 1]));//, dp[i - 1][j ^ 1] + llabs(a[i] - a[i - 1])));
            }

            updmax(ans, dp[i][j]);
        }
    }

    prllnl(ans);

#ifdef FILEIO
    in.close();
    out.close();
#endif
    return 0;
}


// BEGIN OF TEMPLATE //

// Inclusions:
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <memory.h>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <string.h>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>

// Namespaces:
using namespace std;

// Type definitions:
typedef const int cint;
typedef unsigned int uint;
typedef long long ll;
typedef const long long cll;
typedef unsigned long long ull;
typedef long double ld;
typedef const long double cld;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pld;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<vvvi> vvvvi;
typedef vector<bool> vb;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<string> vs;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
typedef vector<pld> vpld;
typedef set<int> si;
typedef set<ll> sll;
typedef set<ld> sld;
typedef set<string> ss;
typedef map<int, int> mi;
typedef map<ll, ll> mll;
typedef map<int, ll> mill;
typedef map<ll, int> mlli;
typedef map<int, string> mis;
typedef map<string, int> msi;

// Definitions:
#define EXTRA_MEMORY 3

#define FOR(i, s, f) for (decltype(s) (i) = (s); (i) < (f); ++(i))
#define ROF(i, f, s) for (decltype(s) (i) = (f) - 1; (i) >= (s); --(i))

#define forn(i, f) FOR((i), 0, (f))
#define rofn(i, f) ROF((i), (f), 0)

#define rep(i, s, f) FOR((i), (s), (f) + 1)
#define per(i, s, f) ROF((i), (f) + 1, (s))

#define forit(it, x) for (auto it = (x).begin(); it != (x).end(); ++it)

#define ALL(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())

#define PREF_TASK ""
#define SUFF_TASK ""

//   Scanning
/*
*  sc - scan
*  pr - print
*  i  - int
*  ll - long long
*  ld - long double (etc)
*  s  - safe (with extra memory)
*  d  - with declaration
*  v  - vector (vi - vector<int> etc)
*  nl - new line
*  n  - amount of elements
*  cl - clear
*  r  - relax
*/

//     Scanning for int
#define sci(a) scanf("%d", &(a))
#define sc2i(a, b) scanf("%d%d", &(a), &(b))
#define sc3i(a, b, c) scanf("%d%d%d", &(a), &(b), &(c))

#define scid(a) int (a); sci(a)
#define sc2id(a, b) int (a), (b); sc2i((a), (b))
#define sc3id(a, b, c) int (a), (b), (c); sc3i((a), (b), (c))

#define scvi(a) forn(IT_FOR_SCANNING, sz(a)) sci((a)[IT_FOR_SCANNING])
#define scvin(a, n) forn(IT_FOR_SCANNING, (n)) sci((a)[IT_FOR_SCANNING])
#define scvind(a, n) vi a(n); scvin((a), (n))
#define scvinds(a, n) vi a((n) + EXTRA_MEMORY); scvin((a), (n))

#define sc2vi(a) forn(IT_FOR_SCANNING, min(sz(a), sz(b))) sc2i((a)[IT_FOR_SCANNING], (b)[IT_FOR_SCANNING])
#define sc2vin(a, b, n) forn(IT_FOR_SCANNING, (n)) sc2i((a)[IT_FOR_SCANNING], (b)[IT_FOR_SCANNING])
#define sc2vind(a, b, n) vi a(n), b(n); sc2vin((a), (b), (n))
#define sc2vinds(a, b, n) vi a((n) + EXTRA_MEMORY), b((n) + EXTRA_MEMORY); sc2vin((a), (b), (n))

#define scsin(a, n) forn(IT_FOR_INSERTION, (n)) (a).insert(next_int())
#define scsind(a, n) si (a); scsin(a, n)

//     Scanning for ll
#define scll(a) scanf("%lld", &(a))
#define sc2ll(a, b) scanf("%lld%lld", &(a), &(b))
#define sc3ll(a, b, c) scanf("%lld%lld%lld", &(a), &(b), &(c))

#define sclld(a) ll (a); scll(a)
#define sc2lld(a, b) ll (a), (b); sc2ll((a), (b))
#define sc3lld(a, b, c) ll (a), (b), (c); sc3ll((a), (b), (c))

#define scvll(a) forn(IT_FOR_SCANNING, sz(a)) scll((a)[IT_FOR_SCANNING])
#define scvlln(a, n) forn(IT_FOR_SCANNING, (n)) scll((a)[IT_FOR_SCANNING])
#define scvllnd(a, n) vll a(n); scvlln((a), (n))
#define scvllnds(a, n) vll a((n) + EXTRA_MEMORY); scvlln((a), (n))

#define sc2vll(a) forn(IT_FOR_SCANNING, min(sz(a), sz(b))) sc2ll((a)[IT_FOR_SCANNING], (b)[IT_FOR_SCANNING])
#define sc2vlln(a, b, n) forn(IT_FOR_SCANNING, (n)) sc2ll((a)[IT_FOR_SCANNING], (b)[IT_FOR_SCANNING])
#define sc2vllnd(a, b, n) vll a(n), b(n); sc2vlln((a), (b), (n))
#define sc2vllnds(a, b, n) vll a((n) + EXTRA_MEMORY), b((n) + EXTRA_MEMORY); sc2vlln((a), (b), (n))

#define scslln(a, n) forn(IT_FOR_INSERTION, (n)) (a).insert(next_ll())
#define scsllnd(a, n) sll (a); scslln(a, n)

//   Printing
#define prnl printf("\n")

//     Printing for int
#define pri(a) printf("%d ", (a))
#define pr2i(a, b) printf("%d %d ", (a), (b))
#define pr3i(a, b, c) printf("%d %d %d ", (a), (b), (c))

#define prinl(a) printf("%d\n", (a))
#define pr2inl(a, b) printf("%d %d\n", (a), (b))
#define pr3inl(a, b, c) printf("%d %d %d\n", (a), (b), (c))

#define prvi(a) forn(IT_FOR_PRINTING, sz(a)) pri((a)[IT_FOR_PRINTING])
#define prvinl(a) forn(IT_FOR_PRINTING, sz(a)) prinl((a)[IT_FOR_PRINTING])
#define prvin(a, n) forn(IT_FOR_PRINTING, (n)) pri((a)[IT_FOR_PRINTING])
#define prvinnl(a, n) forn(IT_FOR_PRINTING, (n)) prinl((a)[IT_FOR_PRINTING])

//     Printing for ll
#define prll(a) printf("%lld ", (a))
#define pr2ll(a, b) printf("%lld %lld ", (a), (b))
#define pr3ll(a, b, c) printf("%lld %lld %lld ", (a), (b), (c))

#define prllnl(a) printf("%lld\n", (a))
#define pr2llnl(a, b) printf("%lld %lld\n", (a), (b))
#define pr3llnl(a, b, c) printf("%lld %lld %lld\n", (a), (b), (c))

#define prvll(a) forn(IT_FOR_PRINTING, sz(a)) prll((a)[IT_FOR_PRINTING])
#define prvllnl(a) forn(IT_FOR_PRINTING, sz(a)) prllnl((a)[IT_FOR_PRINTING])
#define prvlln(a, n) forn(IT_FOR_PRINTING, (n)) prll((a)[IT_FOR_PRINTING])
#define prvllnnl(a, n) forn(IT_FOR_PRINTING, (n)) prllnl((a)[IT_FOR_PRINTING])

//   Filling of arrays
#define FILL(a, x) memset((a), (x), sizeof(a))
#define FILLN(a, n, x) memset((a), (x), (n) * sizeof(*(a)))
#define cl(a) FILL((a), 0)
#define cln(a, n) FILLN((a), (n), 0)

//   Relaxing of min/max
#define rmin(a, b) (a) = min((a), (b))
#define rmax(a, b) (a) = max((a), (b))

//   MOD
#define modFix(a, MOD) ((((a) % (MOD)) + (MOD)) % (MOD))
#define modSum(a, b, MOD) modFix(((a) + (b)), (MOD))
/* Sub == Subtraction */
#define modSub(a, b, MOD) modFix(((a) - (b)), (MOD))
#define modMul(a, b, MOD) modFix(((ll)(a) * (ll)(b)), (MOD))

//   Fast IO
#define init_cin ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define cout_prec cout.precision(30)

// Templates and overloaded functions:
//   Relaxing min/max
template<class T, class U> inline void relax_min(T &a, U b) { a = min(a, b); }
template<class T, class U> inline void relax_max(T &a, U b) { a = max(a, b); }

template<typename T> inline bool updmax(T &a, const T &b){ return a < b ? a = b, 1 : 0; }
template<typename T> inline bool updmin(T &a, const T &b){ return a > b ? a = b, 1 : 0; }

//   Overloaded functions for stream input/output
template<class T, class U> istream &operator>>(istream &in, pair<T, U> &a)
{
    in >> a.first >> a.second;
    return in;
}

template<class T, class U> ostream &operator<<(ostream &out, const pair<T, U> &a)
{
    out << a.first << ' ' << a.second;
    return out;
}

template<class T> istream &operator>>(istream &in, vector<T> &a)
{
    forn(i, sz(a))
        in >> a[i];
    return in;
}

template<class T> ostream &operator<<(ostream &out, const vector<T> &a)
{
    forn(i, sz(a))
        out << a[i] << ' ';
    return out;
}

//   Instantaneous scanning
int next_int()
{
    scid(tmp);
    return tmp;
}

ll next_ll()
{
    sclld(tmp);
    return tmp;
}

//   MOD
ll modPow(ll a, ll b, ll MOD){
    ll ret = 1;
    for (; b; b >>= 1)
    {
        if (b & 1)
            ret = modMul(ret, a, MOD);
        a = modMul(a, a, MOD);
    }
    return ret;
}

// Constants:
//   Auxiliary constants
cll EXACTLY_ONE_HUNDRED = 100;
cll EXACTLY_ONE_THOUSAND = 1000;
cll EXACTLY_ONE_MILLION = 1000 * 1000;
cll EXACTLY_ONE_BILLION = EXACTLY_ONE_THOUSAND * EXACTLY_ONE_MILLION;

//   Size of array
cint MAXN1 = (int)(EXACTLY_ONE_HUNDRED * EXACTLY_ONE_THOUSAND) + EXTRA_MEMORY;
cint MAXN2 = (int)(2 * EXACTLY_ONE_HUNDRED * EXACTLY_ONE_THOUSAND) + EXTRA_MEMORY;
cint MAXN3 = (int)(3 * EXACTLY_ONE_HUNDRED * EXACTLY_ONE_THOUSAND) + EXTRA_MEMORY;
cint MAXN4 = (int)(4 * EXACTLY_ONE_HUNDRED * EXACTLY_ONE_THOUSAND) + EXTRA_MEMORY;
cint MAXN5 = (int)(5 * EXACTLY_ONE_HUNDRED * EXACTLY_ONE_THOUSAND) + EXTRA_MEMORY;
cint MAXN = MAXN3;

//   Infinities
/* 2 - 2^... */
cint INF = (int)EXACTLY_ONE_BILLION + 7;
cint INF2 = 1 << 30;
cll INFLL = EXACTLY_ONE_BILLION * EXACTLY_ONE_BILLION + 7;
cll INFLL2 = 1LL << 60;

//   Necessary constants
cld Pi = acos(-1.0);
cld EPS = 1e-7;

cint MOD = (int)EXACTLY_ONE_BILLION + 7;

// END OF TEMPLATE //

//#define FILEIO

//ll dp[MAXN][2];

int main()
{
#ifdef FILEIO
    ifstream in(PREF_TASK"in"SUFF_TASK);
    ofstream out(PREF_TASK"out"SUFF_TASK);
#endif

//    init_cin;

    scid(n);
    scvllnd(a, n);

    vector<vll> dp(n, vll(2, -INFLL));
//    forn(i, MAXN) {
//        forn(j, 2) {
//            dp[i][j] = -INFLL;
//        }
//    }

    ll ans = -INFLL;
//    dp[0][0] = dp[0][1] = 0;
    ans = dp[1][0] = llabs(a[1] - a[0]);
    dp[1][1] = 0;
    updmax(ans, 0LL);
//    dp[2][1] = llabs(a[2] - a[1]);
//    ans = dp[1][0] = llabs(a[1] - a[0]);
    FOR(i, 2, n) {   // for r
        if (i & 1) {
            updmax(dp[i][0], max(dp[i - 1][0] + llabs(a[i] - a[i - 1]), llabs(a[i] - a[i - 1])));
            updmax(dp[i][1], dp[i - 1][1] - llabs(a[i] - a[i - 1]));
        } else {
            updmax(dp[i][0], dp[i - 1][0] - llabs(a[i] - a[i - 1]));
            updmax(dp[i][1], max(dp[i - 1][1] + llabs(a[i] - a[i - 1]), llabs(a[i] - a[i - 1])));
        }

//        forn(j, 2) {
//            if ((i & 1) ^ (j & 1)) {
//                updmax(dp[i][j], max(dp[i - 1][j] + llabs(a[i] - a[i - 1]), llabs(a[i] - a[i - 1])));
//            } else {
//                updmax(dp[i][j], max(dp[i - 1][j] - llabs(a[i] - a[i - 1]), llabs(a[i] - a[i - 1])));
//            }
//
            updmax(ans, max(dp[i][0], dp[i][1]));
//        }
    }

    prllnl(ans);

#ifdef FILEIO
    in.close();
    out.close();
#endif
    return 0;
}


// BEGIN OF TEMPLATE //

// Inclusions:
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <memory.h>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <string.h>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>

// Namespaces:
using namespace std;

// Type definitions:
typedef const int cint;
typedef unsigned int uint;
typedef long long ll;
typedef const long long cll;
typedef unsigned long long ull;
typedef long double ld;
typedef const long double cld;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pld;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<vvvi> vvvvi;
typedef vector<bool> vb;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<string> vs;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
typedef vector<pld> vpld;
typedef set<int> si;
typedef set<ll> sll;
typedef set<ld> sld;
typedef set<string> ss;
typedef map<int, int> mi;
typedef map<ll, ll> mll;
typedef map<int, ll> mill;
typedef map<ll, int> mlli;
typedef map<int, string> mis;
typedef map<string, int> msi;

// Definitions:
#define EXTRA_MEMORY 3

#define FOR(i, s, f) for (decltype(s) (i) = (s); (i) < (f); ++(i))
#define ROF(i, f, s) for (decltype(s) (i) = (f) - 1; (i) >= (s); --(i))

#define forn(i, f) FOR((i), 0, (f))
#define rofn(i, f) ROF((i), (f), 0)

#define rep(i, s, f) FOR((i), (s), (f) + 1)
#define per(i, s, f) ROF((i), (f) + 1, (s))

#define forit(it, x) for (auto it = (x).begin(); it != (x).end(); ++it)

#define ALL(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())

#define PREF_TASK ""
#define SUFF_TASK ""

//   Scanning
/*
*  sc - scan
*  pr - print
*  i  - int
*  ll - long long
*  ld - long double (etc)
*  s  - safe (with extra memory)
*  d  - with declaration
*  v  - vector (vi - vector<int> etc)
*  nl - new line
*  n  - amount of elements
*  cl - clear
*  r  - relax
*/

//     Scanning for int
#define sci(a) scanf("%d", &(a))
#define sc2i(a, b) scanf("%d%d", &(a), &(b))
#define sc3i(a, b, c) scanf("%d%d%d", &(a), &(b), &(c))

#define scid(a) int (a); sci(a)
#define sc2id(a, b) int (a), (b); sc2i((a), (b))
#define sc3id(a, b, c) int (a), (b), (c); sc3i((a), (b), (c))

#define scvi(a) forn(IT_FOR_SCANNING, sz(a)) sci((a)[IT_FOR_SCANNING])
#define scvin(a, n) forn(IT_FOR_SCANNING, (n)) sci((a)[IT_FOR_SCANNING])
#define scvind(a, n) vi a(n); scvin((a), (n))
#define scvinds(a, n) vi a((n) + EXTRA_MEMORY); scvin((a), (n))

#define sc2vi(a) forn(IT_FOR_SCANNING, min(sz(a), sz(b))) sc2i((a)[IT_FOR_SCANNING], (b)[IT_FOR_SCANNING])
#define sc2vin(a, b, n) forn(IT_FOR_SCANNING, (n)) sc2i((a)[IT_FOR_SCANNING], (b)[IT_FOR_SCANNING])
#define sc2vind(a, b, n) vi a(n), b(n); sc2vin((a), (b), (n))
#define sc2vinds(a, b, n) vi a((n) + EXTRA_MEMORY), b((n) + EXTRA_MEMORY); sc2vin((a), (b), (n))

#define scsin(a, n) forn(IT_FOR_INSERTION, (n)) (a).insert(next_int())
#define scsind(a, n) si (a); scsin(a, n)

//     Scanning for ll
#define scll(a) scanf("%lld", &(a))
#define sc2ll(a, b) scanf("%lld%lld", &(a), &(b))
#define sc3ll(a, b, c) scanf("%lld%lld%lld", &(a), &(b), &(c))

#define sclld(a) ll (a); scll(a)
#define sc2lld(a, b) ll (a), (b); sc2ll((a), (b))
#define sc3lld(a, b, c) ll (a), (b), (c); sc3ll((a), (b), (c))

#define scvll(a) forn(IT_FOR_SCANNING, sz(a)) scll((a)[IT_FOR_SCANNING])
#define scvlln(a, n) forn(IT_FOR_SCANNING, (n)) scll((a)[IT_FOR_SCANNING])
#define scvllnd(a, n) vll a(n); scvlln((a), (n))
#define scvllnds(a, n) vll a((n) + EXTRA_MEMORY); scvlln((a), (n))

#define sc2vll(a) forn(IT_FOR_SCANNING, min(sz(a), sz(b))) sc2ll((a)[IT_FOR_SCANNING], (b)[IT_FOR_SCANNING])
#define sc2vlln(a, b, n) forn(IT_FOR_SCANNING, (n)) sc2ll((a)[IT_FOR_SCANNING], (b)[IT_FOR_SCANNING])
#define sc2vllnd(a, b, n) vll a(n), b(n); sc2vlln((a), (b), (n))
#define sc2vllnds(a, b, n) vll a((n) + EXTRA_MEMORY), b((n) + EXTRA_MEMORY); sc2vlln((a), (b), (n))

#define scslln(a, n) forn(IT_FOR_INSERTION, (n)) (a).insert(next_ll())
#define scsllnd(a, n) sll (a); scslln(a, n)

//   Printing
#define prnl printf("\n")

//     Printing for int
#define pri(a) printf("%d ", (a))
#define pr2i(a, b) printf("%d %d ", (a), (b))
#define pr3i(a, b, c) printf("%d %d %d ", (a), (b), (c))

#define prinl(a) printf("%d\n", (a))
#define pr2inl(a, b) printf("%d %d\n", (a), (b))
#define pr3inl(a, b, c) printf("%d %d %d\n", (a), (b), (c))

#define prvi(a) forn(IT_FOR_PRINTING, sz(a)) pri((a)[IT_FOR_PRINTING])
#define prvinl(a) forn(IT_FOR_PRINTING, sz(a)) prinl((a)[IT_FOR_PRINTING])
#define prvin(a, n) forn(IT_FOR_PRINTING, (n)) pri((a)[IT_FOR_PRINTING])
#define prvinnl(a, n) forn(IT_FOR_PRINTING, (n)) prinl((a)[IT_FOR_PRINTING])

//     Printing for ll
#define prll(a) printf("%lld ", (a))
#define pr2ll(a, b) printf("%lld %lld ", (a), (b))
#define pr3ll(a, b, c) printf("%lld %lld %lld ", (a), (b), (c))

#define prllnl(a) printf("%lld\n", (a))
#define pr2llnl(a, b) printf("%lld %lld\n", (a), (b))
#define pr3llnl(a, b, c) printf("%lld %lld %lld\n", (a), (b), (c))

#define prvll(a) forn(IT_FOR_PRINTING, sz(a)) prll((a)[IT_FOR_PRINTING])
#define prvllnl(a) forn(IT_FOR_PRINTING, sz(a)) prllnl((a)[IT_FOR_PRINTING])
#define prvlln(a, n) forn(IT_FOR_PRINTING, (n)) prll((a)[IT_FOR_PRINTING])
#define prvllnnl(a, n) forn(IT_FOR_PRINTING, (n)) prllnl((a)[IT_FOR_PRINTING])

//   Filling of arrays
#define FILL(a, x) memset((a), (x), sizeof(a))
#define FILLN(a, n, x) memset((a), (x), (n) * sizeof(*(a)))
#define cl(a) FILL((a), 0)
#define cln(a, n) FILLN((a), (n), 0)

//   Relaxing of min/max
#define rmin(a, b) (a) = min((a), (b))
#define rmax(a, b) (a) = max((a), (b))

//   MOD
#define modFix(a, MOD) ((((a) % (MOD)) + (MOD)) % (MOD))
#define modSum(a, b, MOD) modFix(((a) + (b)), (MOD))
/* Sub == Subtraction */
#define modSub(a, b, MOD) modFix(((a) - (b)), (MOD))
#define modMul(a, b, MOD) modFix(((ll)(a) * (ll)(b)), (MOD))

//   Fast IO
#define init_cin ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define cout_prec cout.precision(30)

// Templates and overloaded functions:
//   Relaxing min/max
template<class T, class U> inline void relax_min(T &a, U b) { a = min(a, b); }
template<class T, class U> inline void relax_max(T &a, U b) { a = max(a, b); }

template<typename T> inline bool updmax(T &a, const T &b){ return a < b ? a = b, 1 : 0; }
template<typename T> inline bool updmin(T &a, const T &b){ return a > b ? a = b, 1 : 0; }

//   Overloaded functions for stream input/output
template<class T, class U> istream &operator>>(istream &in, pair<T, U> &a)
{
    in >> a.first >> a.second;
    return in;
}

template<class T, class U> ostream &operator<<(ostream &out, const pair<T, U> &a)
{
    out << a.first << ' ' << a.second;
    return out;
}

template<class T> istream &operator>>(istream &in, vector<T> &a)
{
    forn(i, sz(a))
        in >> a[i];
    return in;
}

template<class T> ostream &operator<<(ostream &out, const vector<T> &a)
{
    forn(i, sz(a))
        out << a[i] << ' ';
    return out;
}

//   Instantaneous scanning
int next_int()
{
    scid(tmp);
    return tmp;
}

ll next_ll()
{
    sclld(tmp);
    return tmp;
}

//   MOD
ll modPow(ll a, ll b, ll MOD){
    ll ret = 1;
    for (; b; b >>= 1)
    {
        if (b & 1)
            ret = modMul(ret, a, MOD);
        a = modMul(a, a, MOD);
    }
    return ret;
}

// Constants:
//   Auxiliary constants
cll EXACTLY_ONE_HUNDRED = 100;
cll EXACTLY_ONE_THOUSAND = 1000;
cll EXACTLY_ONE_MILLION = 1000 * 1000;
cll EXACTLY_ONE_BILLION = EXACTLY_ONE_THOUSAND * EXACTLY_ONE_MILLION;

//   Size of array
cint MAXN1 = (int)(EXACTLY_ONE_HUNDRED * EXACTLY_ONE_THOUSAND) + EXTRA_MEMORY;
cint MAXN2 = (int)(2 * EXACTLY_ONE_HUNDRED * EXACTLY_ONE_THOUSAND) + EXTRA_MEMORY;
cint MAXN3 = (int)(3 * EXACTLY_ONE_HUNDRED * EXACTLY_ONE_THOUSAND) + EXTRA_MEMORY;
cint MAXN4 = (int)(4 * EXACTLY_ONE_HUNDRED * EXACTLY_ONE_THOUSAND) + EXTRA_MEMORY;
cint MAXN5 = (int)(5 * EXACTLY_ONE_HUNDRED * EXACTLY_ONE_THOUSAND) + EXTRA_MEMORY;
cint MAXN = MAXN3;

//   Infinities
/* 2 - 2^... */
cint INF = (int)EXACTLY_ONE_BILLION + 7;
cint INF2 = 1 << 30;
cll INFLL = EXACTLY_ONE_BILLION * EXACTLY_ONE_BILLION + 7;
cll INFLL2 = 1LL << 60;

//   Necessary constants
cld Pi = acos(-1.0);
cld EPS = 1e-7;

cint MOD = (int)EXACTLY_ONE_BILLION + 7;

// END OF TEMPLATE //

//#define FILEIO

int main()
{
#ifdef FILEIO
    ifstream in(PREF_TASK"in"SUFF_TASK);
    ofstream out(PREF_TASK"out"SUFF_TASK);
#endif

    scid(n);
    scvllnd(a, n);

    vector<vll> dp(n, vll(2, -INFLL));

    ll ans = dp[1][0] = llabs(a[1] - a[0]);
    dp[1][1] = 0;

    FOR(i, 2, n) {
        ll delta = llabs(a[i] - a[i - 1]);
        if (i & 1) {
            updmax(dp[i][0], max(dp[i - 1][0], 0) + delta);
            updmax(dp[i][1], dp[i - 1][1] - delta);
        } else {
            updmax(dp[i][0], dp[i - 1][0] - delta);
            updmax(dp[i][1], max(dp[i - 1][1], 0) + delta));
        }

        updmax(ans, max(dp[i][0], dp[i][1]));
    }

    prllnl(ans);

#ifdef FILEIO
    in.close();
    out.close();
#endif
    return 0;
}


// BEGIN OF TEMPLATE //

// Inclusions:
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <memory.h>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <string.h>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>

// Namespaces:
using namespace std;

// Type definitions:
typedef const int cint;
typedef unsigned int uint;
typedef long long ll;
typedef const long long cll;
typedef unsigned long long ull;
typedef long double ld;
typedef const long double cld;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pld;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<vvvi> vvvvi;
typedef vector<bool> vb;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<string> vs;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
typedef vector<pld> vpld;
typedef set<int> si;
typedef set<ll> sll;
typedef set<ld> sld;
typedef set<string> ss;
typedef map<int, int> mi;
typedef map<ll, ll> mll;
typedef map<int, ll> mill;
typedef map<ll, int> mlli;
typedef map<int, string> mis;
typedef map<string, int> msi;

// Definitions:
#define EXTRA_MEMORY 3

#define FOR(i, s, f) for (decltype(s) (i) = (s); (i) < (f); ++(i))
#define ROF(i, f, s) for (decltype(s) (i) = (f) - 1; (i) >= (s); --(i))

#define forn(i, f) FOR((i), 0, (f))
#define rofn(i, f) ROF((i), (f), 0)

#define rep(i, s, f) FOR((i), (s), (f) + 1)
#define per(i, s, f) ROF((i), (f) + 1, (s))

#define forit(it, x) for (auto it = (x).begin(); it != (x).end(); ++it)

#define ALL(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())

#define PREF_TASK ""
#define SUFF_TASK ""

//   Scanning
/*
*  sc - scan
*  pr - print
*  i  - int
*  ll - long long
*  ld - long double (etc)
*  s  - safe (with extra memory)
*  d  - with declaration
*  v  - vector (vi - vector<int> etc)
*  nl - new line
*  n  - amount of elements
*  cl - clear
*  r  - relax
*/

//     Scanning for int
#define sci(a) scanf("%d", &(a))
#define sc2i(a, b) scanf("%d%d", &(a), &(b))
#define sc3i(a, b, c) scanf("%d%d%d", &(a), &(b), &(c))

#define scid(a) int (a); sci(a)
#define sc2id(a, b) int (a), (b); sc2i((a), (b))
#define sc3id(a, b, c) int (a), (b), (c); sc3i((a), (b), (c))

#define scvi(a) forn(IT_FOR_SCANNING, sz(a)) sci((a)[IT_FOR_SCANNING])
#define scvin(a, n) forn(IT_FOR_SCANNING, (n)) sci((a)[IT_FOR_SCANNING])
#define scvind(a, n) vi a(n); scvin((a), (n))
#define scvinds(a, n) vi a((n) + EXTRA_MEMORY); scvin((a), (n))

#define sc2vi(a) forn(IT_FOR_SCANNING, min(sz(a), sz(b))) sc2i((a)[IT_FOR_SCANNING], (b)[IT_FOR_SCANNING])
#define sc2vin(a, b, n) forn(IT_FOR_SCANNING, (n)) sc2i((a)[IT_FOR_SCANNING], (b)[IT_FOR_SCANNING])
#define sc2vind(a, b, n) vi a(n), b(n); sc2vin((a), (b), (n))
#define sc2vinds(a, b, n) vi a((n) + EXTRA_MEMORY), b((n) + EXTRA_MEMORY); sc2vin((a), (b), (n))

#define scsin(a, n) forn(IT_FOR_INSERTION, (n)) (a).insert(next_int())
#define scsind(a, n) si (a); scsin(a, n)

//     Scanning for ll
#define scll(a) scanf("%lld", &(a))
#define sc2ll(a, b) scanf("%lld%lld", &(a), &(b))
#define sc3ll(a, b, c) scanf("%lld%lld%lld", &(a), &(b), &(c))

#define sclld(a) ll (a); scll(a)
#define sc2lld(a, b) ll (a), (b); sc2ll((a), (b))
#define sc3lld(a, b, c) ll (a), (b), (c); sc3ll((a), (b), (c))

#define scvll(a) forn(IT_FOR_SCANNING, sz(a)) scll((a)[IT_FOR_SCANNING])
#define scvlln(a, n) forn(IT_FOR_SCANNING, (n)) scll((a)[IT_FOR_SCANNING])
#define scvllnd(a, n) vll a(n); scvlln((a), (n))
#define scvllnds(a, n) vll a((n) + EXTRA_MEMORY); scvlln((a), (n))

#define sc2vll(a) forn(IT_FOR_SCANNING, min(sz(a), sz(b))) sc2ll((a)[IT_FOR_SCANNING], (b)[IT_FOR_SCANNING])
#define sc2vlln(a, b, n) forn(IT_FOR_SCANNING, (n)) sc2ll((a)[IT_FOR_SCANNING], (b)[IT_FOR_SCANNING])
#define sc2vllnd(a, b, n) vll a(n), b(n); sc2vlln((a), (b), (n))
#define sc2vllnds(a, b, n) vll a((n) + EXTRA_MEMORY), b((n) + EXTRA_MEMORY); sc2vlln((a), (b), (n))

#define scslln(a, n) forn(IT_FOR_INSERTION, (n)) (a).insert(next_ll())
#define scsllnd(a, n) sll (a); scslln(a, n)

//   Printing
#define prnl printf("\n")

//     Printing for int
#define pri(a) printf("%d ", (a))
#define pr2i(a, b) printf("%d %d ", (a), (b))
#define pr3i(a, b, c) printf("%d %d %d ", (a), (b), (c))

#define prinl(a) printf("%d\n", (a))
#define pr2inl(a, b) printf("%d %d\n", (a), (b))
#define pr3inl(a, b, c) printf("%d %d %d\n", (a), (b), (c))

#define prvi(a) forn(IT_FOR_PRINTING, sz(a)) pri((a)[IT_FOR_PRINTING])
#define prvinl(a) forn(IT_FOR_PRINTING, sz(a)) prinl((a)[IT_FOR_PRINTING])
#define prvin(a, n) forn(IT_FOR_PRINTING, (n)) pri((a)[IT_FOR_PRINTING])
#define prvinnl(a, n) forn(IT_FOR_PRINTING, (n)) prinl((a)[IT_FOR_PRINTING])

//     Printing for ll
#define prll(a) printf("%lld ", (a))
#define pr2ll(a, b) printf("%lld %lld ", (a), (b))
#define pr3ll(a, b, c) printf("%lld %lld %lld ", (a), (b), (c))

#define prllnl(a) printf("%lld\n", (a))
#define pr2llnl(a, b) printf("%lld %lld\n", (a), (b))
#define pr3llnl(a, b, c) printf("%lld %lld %lld\n", (a), (b), (c))

#define prvll(a) forn(IT_FOR_PRINTING, sz(a)) prll((a)[IT_FOR_PRINTING])
#define prvllnl(a) forn(IT_FOR_PRINTING, sz(a)) prllnl((a)[IT_FOR_PRINTING])
#define prvlln(a, n) forn(IT_FOR_PRINTING, (n)) prll((a)[IT_FOR_PRINTING])
#define prvllnnl(a, n) forn(IT_FOR_PRINTING, (n)) prllnl((a)[IT_FOR_PRINTING])

//   Filling of arrays
#define FILL(a, x) memset((a), (x), sizeof(a))
#define FILLN(a, n, x) memset((a), (x), (n) * sizeof(*(a)))
#define cl(a) FILL((a), 0)
#define cln(a, n) FILLN((a), (n), 0)

//   Relaxing of min/max
#define rmin(a, b) (a) = min((a), (b))
#define rmax(a, b) (a) = max((a), (b))

//   MOD
#define modFix(a, MOD) ((((a) % (MOD)) + (MOD)) % (MOD))
#define modSum(a, b, MOD) modFix(((a) + (b)), (MOD))
/* Sub == Subtraction */
#define modSub(a, b, MOD) modFix(((a) - (b)), (MOD))
#define modMul(a, b, MOD) modFix(((ll)(a) * (ll)(b)), (MOD))

//   Fast IO
#define init_cin ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define cout_prec cout.precision(30)

// Templates and overloaded functions:
//   Relaxing min/max
template<class T, class U> inline void relax_min(T &a, U b) { a = min(a, b); }
template<class T, class U> inline void relax_max(T &a, U b) { a = max(a, b); }

template<typename T> inline bool updmax(T &a, const T &b){ return a < b ? a = b, 1 : 0; }
template<typename T> inline bool updmin(T &a, const T &b){ return a > b ? a = b, 1 : 0; }

//   Overloaded functions for stream input/output
template<class T, class U> istream &operator>>(istream &in, pair<T, U> &a)
{
    in >> a.first >> a.second;
    return in;
}

template<class T, class U> ostream &operator<<(ostream &out, const pair<T, U> &a)
{
    out << a.first << ' ' << a.second;
    return out;
}

template<class T> istream &operator>>(istream &in, vector<T> &a)
{
    forn(i, sz(a))
        in >> a[i];
    return in;
}

template<class T> ostream &operator<<(ostream &out, const vector<T> &a)
{
    forn(i, sz(a))
        out << a[i] << ' ';
    return out;
}

//   Instantaneous scanning
int next_int()
{
    scid(tmp);
    return tmp;
}

ll next_ll()
{
    sclld(tmp);
    return tmp;
}

//   MOD
ll modPow(ll a, ll b, ll MOD){
    ll ret = 1;
    for (; b; b >>= 1)
    {
        if (b & 1)
            ret = modMul(ret, a, MOD);
        a = modMul(a, a, MOD);
    }
    return ret;
}

// Constants:
//   Auxiliary constants
cll EXACTLY_ONE_HUNDRED = 100;
cll EXACTLY_ONE_THOUSAND = 1000;
cll EXACTLY_ONE_MILLION = 1000 * 1000;
cll EXACTLY_ONE_BILLION = EXACTLY_ONE_THOUSAND * EXACTLY_ONE_MILLION;

//   Size of array
cint MAXN1 = (int)(EXACTLY_ONE_HUNDRED * EXACTLY_ONE_THOUSAND) + EXTRA_MEMORY;
cint MAXN2 = (int)(2 * EXACTLY_ONE_HUNDRED * EXACTLY_ONE_THOUSAND) + EXTRA_MEMORY;
cint MAXN3 = (int)(3 * EXACTLY_ONE_HUNDRED * EXACTLY_ONE_THOUSAND) + EXTRA_MEMORY;
cint MAXN4 = (int)(4 * EXACTLY_ONE_HUNDRED * EXACTLY_ONE_THOUSAND) + EXTRA_MEMORY;
cint MAXN5 = (int)(5 * EXACTLY_ONE_HUNDRED * EXACTLY_ONE_THOUSAND) + EXTRA_MEMORY;
cint MAXN = MAXN3;

//   Infinities
/* 2 - 2^... */
cint INF = (int)EXACTLY_ONE_BILLION + 7;
cint INF2 = 1 << 30;
cll INFLL = EXACTLY_ONE_BILLION * EXACTLY_ONE_BILLION + 7;
cll INFLL2 = 1LL << 60;

//   Necessary constants
cld Pi = acos(-1.0);
cld EPS = 1e-7;

cint MOD = (int)EXACTLY_ONE_BILLION + 7;

// END OF TEMPLATE //

//#define FILEIO

int main()
{
#ifdef FILEIO
    ifstream in(PREF_TASK"in"SUFF_TASK);
    ofstream out(PREF_TASK"out"SUFF_TASK);
#endif

    scid(n);
    scvllnd(a, n);

    vector<vll> dp(n, vll(2, -INFLL));

    ll ans = dp[1][0] = llabs(a[1] - a[0]);
    dp[1][1] = 0;

    FOR(i, 2, n) {
        ll delta = llabs(a[i] - a[i - 1]);
        if (i & 1) {
            updmax(dp[i][0], max(dp[i - 1][0], 0LL) + delta);
            updmax(dp[i][1], dp[i - 1][1] - delta);
        } else {
            updmax(dp[i][0], dp[i - 1][0] - delta);
            updmax(dp[i][1], max(dp[i - 1][1], 0LL) + delta);
        }

        updmax(ans, max(dp[i][0], dp[i][1]));
    }

    prllnl(ans);

#ifdef FILEIO
    in.close();
    out.close();
#endif
    return 0;
}


// BEGIN OF TEMPLATE //

// Inclusions:
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <memory.h>
#include <queue>
#include <random>
#include <set>
#include <string>
#include <string.h>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>

// Namespaces:
using namespace std;

// Type definitions:
typedef const int cint;
typedef unsigned int uint;
typedef long long ll;
typedef const long long cll;
typedef unsigned long long ull;
typedef long double ld;
typedef const long double cld;
typedef pair<int, int> pi;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pld;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<vvvi> vvvvi;
typedef vector<bool> vb;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<string> vs;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
typedef vector<pld> vpld;
typedef set<int> si;
typedef set<ll> sll;
typedef set<ld> sld;
typedef set<string> ss;
typedef map<int, int> mi;
typedef map<ll, ll> mll;
typedef map<int, ll> mill;
typedef map<ll, int> mlli;
typedef map<int, string> mis;
typedef map<string, int> msi;

// Definitions:
#define EXTRA_MEMORY 3

#define FOR(i, s, f) for (decltype(s) (i) = (s); (i) < (f); ++(i))
#define ROF(i, f, s) for (decltype(s) (i) = (f) - 1; (i) >= (s); --(i))

#define forn(i, f) FOR((i), 0, (f))
#define rofn(i, f) ROF((i), (f), 0)

#define rep(i, s, f) FOR((i), (s), (f) + 1)
#define per(i, s, f) ROF((i), (f) + 1, (s))

#define forit(it, x) for (auto it = (x).begin(); it != (x).end(); ++it)

#define ALL(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())

#define PREF_TASK ""
#define SUFF_TASK ""

//   Scanning
/*
*  sc - scan
*  pr - print
*  i  - int
*  ll - long long
*  ld - long double (etc)
*  s  - safe (with extra memory)
*  d  - with declaration
*  v  - vector (vi - vector<int> etc)
*  nl - new line
*  n  - amount of elements
*  cl - clear
*  r  - relax
*/

//     Scanning for int
#define sci(a) scanf("%d", &(a))
#define sc2i(a, b) scanf("%d%d", &(a), &(b))
#define sc3i(a, b, c) scanf("%d%d%d", &(a), &(b), &(c))

#define scid(a) int (a); sci(a)
#define sc2id(a, b) int (a), (b); sc2i((a), (b))
#define sc3id(a, b, c) int (a), (b), (c); sc3i((a), (b), (c))

#define scvi(a) forn(IT_FOR_SCANNING, sz(a)) sci((a)[IT_FOR_SCANNING])
#define scvin(a, n) forn(IT_FOR_SCANNING, (n)) sci((a)[IT_FOR_SCANNING])
#define scvind(a, n) vi a(n); scvin((a), (n))
#define scvinds(a, n) vi a((n) + EXTRA_MEMORY); scvin((a), (n))

#define sc2vi(a) forn(IT_FOR_SCANNING, min(sz(a), sz(b))) sc2i((a)[IT_FOR_SCANNING], (b)[IT_FOR_SCANNING])
#define sc2vin(a, b, n) forn(IT_FOR_SCANNING, (n)) sc2i((a)[IT_FOR_SCANNING], (b)[IT_FOR_SCANNING])
#define sc2vind(a, b, n) vi a(n), b(n); sc2vin((a), (b), (n))
#define sc2vinds(a, b, n) vi a((n) + EXTRA_MEMORY), b((n) + EXTRA_MEMORY); sc2vin((a), (b), (n))

#define scsin(a, n) forn(IT_FOR_INSERTION, (n)) (a).insert(next_int())
#define scsind(a, n) si (a); scsin(a, n)

//     Scanning for ll
#define scll(a) scanf("%lld", &(a))
#define sc2ll(a, b) scanf("%lld%lld", &(a), &(b))
#define sc3ll(a, b, c) scanf("%lld%lld%lld", &(a), &(b), &(c))

#define sclld(a) ll (a); scll(a)
#define sc2lld(a, b) ll (a), (b); sc2ll((a), (b))
#define sc3lld(a, b, c) ll (a), (b), (c); sc3ll((a), (b), (c))

#define scvll(a) forn(IT_FOR_SCANNING, sz(a)) scll((a)[IT_FOR_SCANNING])
#define scvlln(a, n) forn(IT_FOR_SCANNING, (n)) scll((a)[IT_FOR_SCANNING])
#define scvllnd(a, n) vll a(n); scvlln((a), (n))
#define scvllnds(a, n) vll a((n) + EXTRA_MEMORY); scvlln((a), (n))

#define sc2vll(a) forn(IT_FOR_SCANNING, min(sz(a), sz(b))) sc2ll((a)[IT_FOR_SCANNING], (b)[IT_FOR_SCANNING])
#define sc2vlln(a, b, n) forn(IT_FOR_SCANNING, (n)) sc2ll((a)[IT_FOR_SCANNING], (b)[IT_FOR_SCANNING])
#define sc2vllnd(a, b, n) vll a(n), b(n); sc2vlln((a), (b), (n))
#define sc2vllnds(a, b, n) vll a((n) + EXTRA_MEMORY), b((n) + EXTRA_MEMORY); sc2vlln((a), (b), (n))

#define scslln(a, n) forn(IT_FOR_INSERTION, (n)) (a).insert(next_ll())
#define scsllnd(a, n) sll (a); scslln(a, n)

//   Printing
#define prnl printf("\n")

//     Printing for int
#define pri(a) printf("%d ", (a))
#define pr2i(a, b) printf("%d %d ", (a), (b))
#define pr3i(a, b, c) printf("%d %d %d ", (a), (b), (c))

#define prinl(a) printf("%d\n", (a))
#define pr2inl(a, b) printf("%d %d\n", (a), (b))
#define pr3inl(a, b, c) printf("%d %d %d\n", (a), (b), (c))

#define prvi(a) forn(IT_FOR_PRINTING, sz(a)) pri((a)[IT_FOR_PRINTING])
#define prvinl(a) forn(IT_FOR_PRINTING, sz(a)) prinl((a)[IT_FOR_PRINTING])
#define prvin(a, n) forn(IT_FOR_PRINTING, (n)) pri((a)[IT_FOR_PRINTING])
#define prvinnl(a, n) forn(IT_FOR_PRINTING, (n)) prinl((a)[IT_FOR_PRINTING])

//     Printing for ll
#define prll(a) printf("%lld ", (a))
#define pr2ll(a, b) printf("%lld %lld ", (a), (b))
#define pr3ll(a, b, c) printf("%lld %lld %lld ", (a), (b), (c))

#define prllnl(a) printf("%lld\n", (a))
#define pr2llnl(a, b) printf("%lld %lld\n", (a), (b))
#define pr3llnl(a, b, c) printf("%lld %lld %lld\n", (a), (b), (c))

#define prvll(a) forn(IT_FOR_PRINTING, sz(a)) prll((a)[IT_FOR_PRINTING])
#define prvllnl(a) forn(IT_FOR_PRINTING, sz(a)) prllnl((a)[IT_FOR_PRINTING])
#define prvlln(a, n) forn(IT_FOR_PRINTING, (n)) prll((a)[IT_FOR_PRINTING])
#define prvllnnl(a, n) forn(IT_FOR_PRINTING, (n)) prllnl((a)[IT_FOR_PRINTING])

//   Filling of arrays
#define FILL(a, x) memset((a), (x), sizeof(a))
#define FILLN(a, n, x) memset((a), (x), (n) * sizeof(*(a)))
#define cl(a) FILL((a), 0)
#define cln(a, n) FILLN((a), (n), 0)

//   Relaxing of min/max
#define rmin(a, b) (a) = min((a), (b))
#define rmax(a, b) (a) = max((a), (b))

//   MOD
#define modFix(a, MOD) ((((a) % (MOD)) + (MOD)) % (MOD))
#define modSum(a, b, MOD) modFix(((a) + (b)), (MOD))
/* Sub == Subtraction */
#define modSub(a, b, MOD) modFix(((a) - (b)), (MOD))
#define modMul(a, b, MOD) modFix(((ll)(a) * (ll)(b)), (MOD))

//   Fast IO
#define init_cin ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define cout_prec cout.precision(30)

// Templates and overloaded functions:
//   Relaxing min/max
template<class T, class U> inline void relax_min(T &a, U b) { a = min(a, b); }
template<class T, class U> inline void relax_max(T &a, U b) { a = max(a, b); }

template<typename T> inline bool updmax(T &a, const T &b){ return a < b ? a = b, 1 : 0; }
template<typename T> inline bool updmin(T &a, const T &b){ return a > b ? a = b, 1 : 0; }

//   Overloaded functions for stream input/output
template<class T, class U> istream &operator>>(istream &in, pair<T, U> &a)
{
    in >> a.first >> a.second;
    return in;
}

template<class T, class U> ostream &operator<<(ostream &out, const pair<T, U> &a)
{
    out << a.first << ' ' << a.second;
    return out;
}

template<class T> istream &operator>>(istream &in, vector<T> &a)
{
    forn(i, sz(a))
        in >> a[i];
    return in;
}

template<class T> ostream &operator<<(ostream &out, const vector<T> &a)
{
    forn(i, sz(a))
        out << a[i] << ' ';
    return out;
}

//   Instantaneous scanning
int next_int()
{
    scid(tmp);
    return tmp;
}

ll next_ll()
{
    sclld(tmp);
    return tmp;
}

//   MOD
ll modPow(ll a, ll b, ll MOD){
    ll ret = 1;
    for (; b; b >>= 1)
    {
        if (b & 1)
            ret = modMul(ret, a, MOD);
        a = modMul(a, a, MOD);
    }
    return ret;
}

// Constants:
//   Auxiliary constants
cll EXACTLY_ONE_HUNDRED = 100;
cll EXACTLY_ONE_THOUSAND = 1000;
cll EXACTLY_ONE_MILLION = 1000 * 1000;
cll EXACTLY_ONE_BILLION = EXACTLY_ONE_THOUSAND * EXACTLY_ONE_MILLION;

//   Size of array
cint MAXN1 = (int)(EXACTLY_ONE_HUNDRED * EXACTLY_ONE_THOUSAND) + EXTRA_MEMORY;
cint MAXN2 = (int)(2 * EXACTLY_ONE_HUNDRED * EXACTLY_ONE_THOUSAND) + EXTRA_MEMORY;
cint MAXN3 = (int)(3 * EXACTLY_ONE_HUNDRED * EXACTLY_ONE_THOUSAND) + EXTRA_MEMORY;
cint MAXN4 = (int)(4 * EXACTLY_ONE_HUNDRED * EXACTLY_ONE_THOUSAND) + EXTRA_MEMORY;
cint MAXN5 = (int)(5 * EXACTLY_ONE_HUNDRED * EXACTLY_ONE_THOUSAND) + EXTRA_MEMORY;
cint MAXN = MAXN3;

//   Infinities
/* 2 - 2^... */
cint INF = (int)EXACTLY_ONE_BILLION + 7;
cint INF2 = 1 << 30;
cll INFLL = EXACTLY_ONE_BILLION * EXACTLY_ONE_BILLION + 7;
cll INFLL2 = 1LL << 60;

//   Necessary constants
cld Pi = acos(-1.0);
cld EPS = 1e-7;

cint MOD = (int)EXACTLY_ONE_BILLION + 7;

// END OF TEMPLATE //

//#define FILEIO

//ll dp[MAXN][2];

int main()
{
#ifdef FILEIO
    ifstream in(PREF_TASK"in"SUFF_TASK);
    ofstream out(PREF_TASK"out"SUFF_TASK);
#endif

//    init_cin;

    scid(n);
    scvllnd(a, n);

    vector<vll> dp(n, vll(2, -INFLL));
//    forn(i, MAXN) {
//        forn(j, 2) {
//            dp[i][j] = -INFLL;
//        }
//    }

    ll ans = -INFLL;
//    dp[0][0] = dp[0][1] = 0;
    ans = dp[1][0] = llabs(a[1] - a[0]);
    dp[1][1] = 0;
    updmax(ans, 0LL);
//    dp[2][1] = llabs(a[2] - a[1]);
//    ans = dp[1][0] = llabs(a[1] - a[0]);
    FOR(i, 2, n) {   // for r
//        if (i & 1) {
//            updmax(dp[i][0], dp[i - 1][0] + llabs(a[i] - a[i - 1]));
//            updmax(dp[i][1], dp[i - 1][1] - llabs(a[i] - a[i - 1]));
//        } else {
//            updmax(dp[i][0], dp[i - 1][0] - llabs(a[i] - a[i - 1]));
//            updmax(dp[i][1], dp[i - 1][1] + llabs(a[i] - a[i - 1]));
//        }
//
        forn(j, 2) {
            if ((i & 1) ^ (j & 1)) {
                updmax(dp[i][j], dp[i - 1][j] + llabs(a[i] - a[i - 1]));
            } else {
                updmax(dp[i][j], dp[i - 1][j] - llabs(a[i] - a[i - 1]));
            }

            updmax(ans, max(dp[i][0], dp[i][1]));
        }
    }

    prllnl(ans);

#ifdef FILEIO
    in.close();
    out.close();
#endif
    return 0;
}


//#include<bits/stdc++.h>
#include <iostream>
#include<cstdio>
#include<queue>
#include<vector>
#include<cmath>
#include<cstring>
#include<string>
#include<set>
#include<map>
#include<algorithm>
//#include<ctime>
#include<cstdlib>

using namespace std;
typedef long long LL;

const int maxn=100000+5;

//const int INF=1<<25;
const int MOD=1e7+9;
/*
int getint()
{
    int x=0;char ch=getchar();
    while(ch<'0'||ch>'9')ch=getchar();
    while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
    return x;
}
*/
/*
int n,t[200005],dp[100010];
int lowbit(int x)
{
    return x&(-x);
}
void change(int x,int p)
{
    while(x<=n)
    {
        t[x]+=p;
        t[x]%=MOD;
        x+=lowbit(x);
    }
    return;
}
int sum(int k)
{
    int ans=0;
    while(k>0)
    {
        ans+=t[k];
        ans%=MOD;
        k-=lowbit(k);
    }
    return ans;
}
int ask(int l,int r)
{
    return sum(r)-sum(l-1);
}
*/

int sum[maxn],de[maxn],dd[maxn];

int main()
{
    int pre,cur=0,n;
    scanf("%d",&n);
    scanf("%d",&pre);
    for (int i=1;i<n;++i)
    {
        scanf("%d",&cur);
        sum[i]=pre-cur;

        if(i%2==0)
            sum[i]=-abs(sum[i]);
        else
            sum[i]=abs(sum[i]);
        //cout<<sum[i]<<endl;
        pre=cur;
    }
    int ans=0;
    dd[n-1]=sum[n-1];
    sum[n-1]=-sum[n-1];
    ans=max(ans,dd[n-1]);
    for (int i=n-2;i>=1;i--)
    {

        dd[i]=sum[i];
        if(dd[i+1]>0)
            dd[i]+=dd[i+1];
        if(i%2)
            ans=max(ans,dd[i]);
        sum[i]=-sum[i];
        //cout<<dd[i]<<" ";
    }
    //cout<<ans<<endl;
    de[n-1]=sum[n-1];
    ans=max(ans,de[n-1]);
    for (int i=n-2;i>=1;i--)
    {
        de[i]=sum[i];
        if(de[i+1]>0)
            de[i]+=de[i+1];
        if(i%2==0)
            ans=max(ans,de[i]);
        //cout<<de[i]<<" ";
    }
    //cout<<ans<<endl;
    printf("%d\n",ans);
    return 0;
}


//#include<bits/stdc++.h>
#include <iostream>
#include<cstdio>
#include<queue>
#include<vector>
#include<cmath>
#include<cstring>
#include<string>
#include<set>
#include<map>
#include<algorithm>
//#include<ctime>
#include<cstdlib>

using namespace std;
typedef long long LL;

const int maxn=100000+5;

//const int INF=1<<25;
const int MOD=1e7+9;
/*
int getint()
{
    int x=0;char ch=getchar();
    while(ch<'0'||ch>'9')ch=getchar();
    while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
    return x;
}
*/
/*
int n,t[200005],dp[100010];
int lowbit(int x)
{
    return x&(-x);
}
void change(int x,int p)
{
    while(x<=n)
    {
        t[x]+=p;
        t[x]%=MOD;
        x+=lowbit(x);
    }
    return;
}
int sum(int k)
{
    int ans=0;
    while(k>0)
    {
        ans+=t[k];
        ans%=MOD;
        k-=lowbit(k);
    }
    return ans;
}
int ask(int l,int r)
{
    return sum(r)-sum(l-1);
}
*/

LL sum[maxn],de[maxn],dd[maxn];

int main()
{
    int pre,cur=0,n;
    scanf("%d",&n);
    scanf("%d",&pre);
    for (int i=1;i<n;++i)
    {
        scanf("%d",&cur);
        sum[i]=pre-cur;

        if(i%2==0)
            sum[i]=-abs(sum[i]);
        else
            sum[i]=abs(sum[i]);
        //cout<<sum[i]<<endl;
        pre=cur;
    }
    LL ans=0;
    dd[n-1]=sum[n-1];
    sum[n-1]=-sum[n-1];
    ans=max(ans,dd[n-1]);
    for (int i=n-2;i>=1;i--)
    {
        dd[i]=sum[i];
        if(dd[i+1]>0)
            dd[i]+=dd[i+1];
        if(i%2)
            ans=max(ans,dd[i]);
        sum[i]=-sum[i];
        //cout<<dd[i]<<" ";
    }
    //cout<<ans<<endl;
    de[n-1]=sum[n-1];
    ans=max(ans,de[n-1]);
    for (int i=n-2;i>=1;i--)
    {
        de[i]=sum[i];
        if(de[i+1]>0)
            de[i]+=de[i+1];
        if(i%2==0)
            ans=max(ans,de[i]);
        //cout<<de[i]<<" ";
    }
    //cout<<ans<<endl;
    printf("%lld\n",ans);
    return 0;
}


//#include<bits/stdc++.h>
#include <iostream>
#include<cstdio>
#include<queue>
#include<vector>
#include<cmath>
#include<cstring>
#include<string>
#include<set>
#include<map>
#include<algorithm>
//#include<ctime>
#include<cstdlib>

using namespace std;
typedef long long LL;

const int maxn=100000+5;

//const int INF=1<<25;
const int MOD=1e7+9;
/*
int getint()
{
    int x=0;char ch=getchar();
    while(ch<'0'||ch>'9')ch=getchar();
    while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
    return x;
}
*/
/*
int n,t[200005],dp[100010];
int lowbit(int x)
{
    return x&(-x);
}
void change(int x,int p)
{
    while(x<=n)
    {
        t[x]+=p;
        t[x]%=MOD;
        x+=lowbit(x);
    }
    return;
}
int sum(int k)
{
    int ans=0;
    while(k>0)
    {
        ans+=t[k];
        ans%=MOD;
        k-=lowbit(k);
    }
    return ans;
}
int ask(int l,int r)
{
    return sum(r)-sum(l-1);
}
*/

int sum[maxn],de[maxn],dd[maxn];

int main()
{
    int pre,cur=0,n;
    scanf("%d",&n);
    scanf("%d",&pre);
    for (int i=1;i<n;++i)
    {
        scanf("%d",&cur);
        sum[i]=pre-cur;

        if(i%2==0)
            sum[i]=-abs(sum[i]);
        else
            sum[i]=abs(sum[i]);
        //cout<<sum[i]<<endl;
        pre=cur;
    }
    int ans=0;
    dd[n-1]=sum[n-1];
    sum[n-1]=-sum[n-1];
    for (int i=n-2;i>=1;i--)
    {

        dd[i]=sum[i];
        if(dd[i+1]>0)
            dd[i]+=dd[i+1];
        if(i%2)
            ans=max(ans,dd[i]);
        sum[i]=-sum[i];
        //cout<<dd[i]<<" ";
    }
    //cout<<endl;
    de[n-1]=sum[n-1];
    for (int i=n-2;i>=1;i--)
    {
        de[i]=sum[i];
        if(dd[i+1]>0)
            dd[i]+=dd[i+1];
        if(i%2==0)
            ans=max(ans,dd[i]);
    }
    printf("%d\n",ans);
    return 0;
}


//#include<bits/stdc++.h>
#include <iostream>
#include<cstdio>
#include<queue>
#include<vector>
#include<cmath>
#include<cstring>
#include<string>
#include<set>
#include<map>
#include<algorithm>
//#include<ctime>
#include<cstdlib>

using namespace std;
typedef long long LL;

const int maxn=100000+5;

//const int INF=1<<25;
const int MOD=1e7+9;
/*
int getint()
{
    int x=0;char ch=getchar();
    while(ch<'0'||ch>'9')ch=getchar();
    while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
    return x;
}
*/
/*
int n,t[200005],dp[100010];
int lowbit(int x)
{
    return x&(-x);
}
void change(int x,int p)
{
    while(x<=n)
    {
        t[x]+=p;
        t[x]%=MOD;
        x+=lowbit(x);
    }
    return;
}
int sum(int k)
{
    int ans=0;
    while(k>0)
    {
        ans+=t[k];
        ans%=MOD;
        k-=lowbit(k);
    }
    return ans;
}
int ask(int l,int r)
{
    return sum(r)-sum(l-1);
}
*/

int sum[maxn],de[maxn],dd[maxn];

int main()
{
    int pre,cur=0,n;
    scanf("%d",&n);
    scanf("%d",&pre);
    for (int i=1;i<n;++i)
    {
        scanf("%d",&cur);
        sum[i]=pre-cur;

        if(i%2==0)
            sum[i]=-abs(sum[i]);
        else
            sum[i]=abs(sum[i]);
        //cout<<sum[i]<<endl;
        pre=cur;
    }
    int ans=0;
    dd[n-1]=sum[n-1];
    sum[n-1]=-sum[n-1];
    for (int i=n-2;i>=1;i--)
    {

        dd[i]=sum[i];
        if(dd[i+1]>0)
            dd[i]+=dd[i+1];
        if(i%2)
            ans=max(ans,dd[i]);
        sum[i]=-sum[i];
        //cout<<dd[i]<<" ";
    }
    //cout<<ans<<endl;
    de[n-1]=sum[n-1];
    for (int i=n-2;i>=1;i--)
    {
        de[i]=sum[i];
        if(de[i+1]>0)
            de[i]+=de[i+1];
        if(i%2==0)
            ans=max(ans,de[i]);
        //cout<<de[i]<<" ";
    }
    //cout<<ans<<endl;
    printf("%d\n",ans);
    return 0;
}


//#include<bits/stdc++.h>
#include <iostream>
#include<cstdio>
#include<queue>
#include<vector>
#include<cmath>
#include<cstring>
#include<string>
#include<set>
#include<map>
#include<algorithm>
//#include<ctime>
#include<cstdlib>

using namespace std;
typedef long long LL;

const int maxn=100000+5;

//const int INF=1<<25;
const int MOD=1e7+9;
/*
int getint()
{
    int x=0;char ch=getchar();
    while(ch<'0'||ch>'9')ch=getchar();
    while(ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
    return x;
}
*/
/*
int n,t[200005],dp[100010];
int lowbit(int x)
{
    return x&(-x);
}
void change(int x,int p)
{
    while(x<=n)
    {
        t[x]+=p;
        t[x]%=MOD;
        x+=lowbit(x);
    }
    return;
}
int sum(int k)
{
    int ans=0;
    while(k>0)
    {
        ans+=t[k];
        ans%=MOD;
        k-=lowbit(k);
    }
    return ans;
}
int ask(int l,int r)
{
    return sum(r)-sum(l-1);
}
*/

LL sum[maxn],de[maxn],dd[maxn];

int main()
{
    int pre,cur=0,n;
    scanf("%d",&n);
    scanf("%d",&pre);
    for (int i=1;i<n;++i)
    {
        scanf("%d",&cur);
        sum[i]=pre-cur;

        if(i%2==0)
            sum[i]=-abs(sum[i]);
        else
            sum[i]=abs(sum[i]);
        //cout<<sum[i]<<endl;
        pre=cur;
    }
    LL ans=0;
    dd[n-1]=sum[n-1];
    sum[n-1]=-sum[n-1];
    ans=max(ans,dd[n-1]);
    for (int i=n-2;i>=1;i--)
    {

        dd[i]=sum[i];
        if(dd[i+1]>0)
            dd[i]+=dd[i+1];
        if(i%2)
            ans=max(ans,dd[i]);
        sum[i]=-sum[i];
        //cout<<dd[i]<<" ";
    }
    //cout<<ans<<endl;
    de[n-1]=sum[n-1];
    ans=max(ans,de[n-1]);
    for (int i=n-2;i>=1;i--)
    {
        de[i]=sum[i];
        if(de[i+1]>0)
            de[i]+=de[i+1];
        if(i%2==0)
            ans=max(ans,de[i]);
        //cout<<de[i]<<" ";
    }
    //cout<<ans<<endl;
    printf("%d\n",ans);
    return 0;
}


#include <iostream>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <stdio.h>
#include <cmath>
#include <sstream>
#include <algorithm>
#include <iomanip>

#define ll long long
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define vi vector<int>
#define vl vector<long long>
#define sz size()
#define x first
#define y second
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;
int n;
ll a[100100], b[100100], c[100100];
ll mn1, mn2;
ll ans = -(ll)1e15;

int main() {
	//freopen("", "r", stdin);
	//freopen("", "w", stdout);
	cin >> n;
	for(int i = 0; i < n; i++) {
		cin >> a[i];
		if(a[i]) {
			b[i - 1] = abs(a[i] - a[i-1]);
			c[i - 1] = b[i - 1];
		}
	}

	for(int i = 0; i < n - 1; i++) {
		if(!(i & 1)) c[i] *= -1;
		else b[i] *= -1;
	}

	/*for(int i = 0; i < n - 1; i++) cout << b[i] << " ";
	cout << endl;
	for(int i = 0; i < n - 1; i++) cout << c[i] << " ";
	cout << endl;*/

	for(int i = 0; i < n - 1; i++) {
		if(i) b[i] += b[i-1];
		if(i) c[i] += c[i-1];
	}

	/*for(int i = 0; i < n - 1; i++) cout << b[i] << " ";
	cout << endl;
	for(int i = 0; i < n - 1; i++) cout << c[i] << " ";*/

	//run on b
	//c[0] = (ll)1e18;

	for(int i = 0; i < n - 1; i++) {
		ans = max(ans, b[i] - mn1);
		if(i % 2 == 1) mn1 = min(mn1, b[i]);
	}

	mn2 = min(mn2, c[0]);
	for(int i = 1; i < n - 1; i++) {
		ans = max(ans, c[i] - mn2);
		if(i % 2 == 0) mn2 = min(mn2, b[i]);
	}

	//run on c
	cout << ans;
	return 0;
}


#include <iostream>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <stdio.h>
#include <cmath>
#include <sstream>
#include <algorithm>
#include <iomanip>

#define ll long long
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define vi vector<int>
#define vl vector<long long>
#define sz size()
#define x first
#define y second
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;
int n;
ll a[100100], b[100100], c[100100];
ll mn1, mn2;
ll ans = 0;

int main() {
	//freopen("", "r", stdin);
	//freopen("", "w", stdout);
	cin >> n;
	for(int i = 0; i < n; i++) {
		cin >> a[i];
		if(a[i]) {
			b[i - 1] = abs(a[i] - a[i-1]);
			c[i - 1] = b[i - 1];
		}
	}

	for(int i = 0; i < n - 1; i++) {
		if(!(i & 1)) c[i] *= -1;
		else b[i] *= -1;
	}

	/*for(int i = 0; i < n - 1; i++) cout << b[i] << " ";
	cout << endl;
	for(int i = 0; i < n - 1; i++) cout << c[i] << " ";
	cout << endl;    */

	for(int i = 0; i < n - 1; i++) {
		if(i) b[i] += b[i-1];
		if(i) c[i] += c[i-1];
	}

	/*for(int i = 0; i < n - 1; i++) cout << b[i] << " ";
	cout << endl;
	for(int i = 0; i < n - 1; i++) cout << c[i] << " ";
	cout << endl;	*/

	//run on b
	//c[0] = (ll)1e18;

	for(int i = 0; i < n - 1; i++) {
		ans = max(ans, b[i] - mn1);
		if(i % 2 == 0) mn1 = min(mn1, b[i]);
	}

	for(int i = 1; i < n - 1; i++) {
		ans = max(ans, c[i] - mn2);
		if(i % 2 == 1) mn2 = min(mn2, b[i]);
	}

	//run on c
	cout << ans;
	return 0;
}


#include <iostream>
#include <map>
#include <set>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <stdio.h>
#include <cmath>
#include <sstream>
#include <algorithm>
#include <iomanip>

#define ll long long
#define mp make_pair
#define pb push_back
#define f first
#define s second
#define vi vector<int>
#define vl vector<long long>
#define sz size()
#define x first
#define y second
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;
int n;
ll a[100100], b[100100], c[100100];
ll mn1, mn2;
ll ans = -(ll)1e18;

int main() {
	//freopen("", "r", stdin);
	//freopen("", "w", stdout);
	cin >> n;
	for(int i = 0; i < n; i++) {
		cin >> a[i];
		if(i) {
			b[i - 1] = abs(a[i] - a[i-1]);
			c[i - 1] = b[i - 1];
		}
	}

	for(int i = 0; i < n - 1; i++) {
		if(!(i & 1)) c[i] *= -1;
		else b[i] *= -1;
	}

	/*for(int i = 0; i < n - 1; i++) cout << b[i] << " ";
	cout << endl;
	for(int i = 0; i < n - 1; i++) cout << c[i] << " ";
	cout << endl;    */

	for(int i = 0; i < n - 1; i++) {
		if(i) b[i] += b[i-1];
		if(i) c[i] += c[i-1];
	}

	/*for(int i = 0; i < n - 1; i++) cout << b[i] << " ";
	cout << endl;
	for(int i = 0; i < n - 1; i++) cout << c[i] << " ";
	cout << endl;	*/

	//run on b
	//c[0] = (ll)1e18;

	for(int i = 0; i < n - 1; i++) {
		ans = max(ans, b[i] - mn1);
		if(i % 2 == 1) mn1 = min(mn1, b[i]);
	}

	mn2 = min(mn2, c[0]);
	for(int i = 1; i < n - 1; i++) {
		ans = max(ans, c[i] - mn2);
		if(i % 2 == 0) mn2 = min(mn2, c[i]);
	}

	cout << ans;

	return 0;
}