import java.util.*;

public class Solution {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);

        int n = in.nextInt();

        List<Integer> a=new ArrayList<Integer>();

        for(int i=0;i<n;i++){
            a.add(in.nextInt());
        }

        int[] f=new int[n];
        int[] f1=new int[n];

        int l=0,l1=0;

        f[0]=0;
        f1[0]=0;

        for(int i=1;i<n;i++){

          if(i%2==1)
              f[i]=min(f[i-1]+mod(a.get(i)-a.get(i-1)),mod(a.get(i)-a.get(i-1)));
           else
              f[i]=min(f[i-1]+(-1)*mod(a.get(i)-a.get(i-1)),(-1)*mod(a.get(i)-a.get(i-1)));

            if(i%2==1)
              f1[i]=max(f1[i-1]+mod(a.get(i)-a.get(i-1)),mod(a.get(i)-a.get(i-1)));
           else
              f1[i]=max(f1[i-1]+(-1)*mod(a.get(i)-a.get(i-1)),(-1)*mod(a.get(i)-a.get(i-1)));

            l=max(l,mod(f[i]));
            l1=max(l1,mod(f1[i]));
        }

        System.out.print(max(l,l1));
    }

    public static int max(int a,int b){
        if(a>b)
            return a;
        else
            return b;
    }

    public static int min(int a,int b){
        if(a<b)
            return a;
        else
            return b;
    }

    public static int mod(int a){
        if(a>0)
            return a;
        else
            return -a;
    }
}


import java.io.*;
import java.util.*;
//import javafx.util.*;
import java.math.*;
//import java.lang.*;
public class Main
{
  //  static int n;static ArrayList<Integer> arr[];
   // int ans[];

    public static void main(String[] args) throws IOException {
    //    Scanner sc=new Scanner(System.in);
        PrintWriter pw = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        br = new BufferedReader(new InputStreamReader(System.in));
        int n=nextInt();
        long arr[]=new long[n];
        for(int i=0;i<n;i++){
            arr[i]=nextLong();

        }
        long diff1[]=new long[n-1];
        long diff2[]=new long[n-1];
        for(int i=0;i<n-1;i++){
            long a=Math.abs(arr[i]-arr[i+1]);
            diff1[i]=(long)Math.pow(-1,i)*a;
            diff2[i]=(long)Math.pow(-1,i+1)*a;
        }
        long ans1=maxSubArraySum(diff1,n-1);
        long ans2=maxSubArraySum(diff2,n-1);
        pw.println(Math.max(ans1,ans2));
        pw.close();

    }

    static long maxSubArraySum(long a[],int size)
{

    long max_so_far = 0, max_ending_here = 0;

    for (int i = 0; i < size; i++)
    {
        max_ending_here = max_ending_here + a[i];
        if (max_ending_here < 0)
            max_ending_here = 0;

        /* Do not compare for all
           elements. Compare only
           when max_ending_here > 0 */
        else if (max_so_far < max_ending_here)
            max_so_far = max_ending_here;

    }
    return max_so_far;
}
    public static BufferedReader br;
    public static StringTokenizer st;
    public static String next() {
        while (st == null || !st.hasMoreTokens()) {
       try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        }
        return st.nextToken();
    }

    public static Integer nextInt() {
        return Integer.parseInt(next());
    }

    public static Long nextLong() {
        return Long.parseLong(next());
    }

    public static Double nextDouble() {
        return Double.parseDouble(next());
    }
    static class Pair{
        int x;int y;int z;
        Pair(int x,int y,int z){
            this.x=x;
            this.y=y;
            this.z=z;
          //  this.i=i;
        }
    }
    static class sorting implements Comparator<Pair>{
        public int compare(Pair a,Pair b){
            //return (a.y)-(b.y);
            return (a.x-b.x);
        }
    }
    public static int[] na(int n)throws IOException{
        int[] a = new int[n];
        for(int i = 0;i < n;i++)a[i] = nextInt();
        return a;
    }
    static class query implements Comparable<query>{
        int l,r,idx,block;
        static int len;
        query(int l,int r,int i){
            this.l=l;
            this.r=r;
            this.idx=i;
            this.block=l/len;
        }
        public int compareTo(query a){
            return block==a.block?r-a.r:block-a.block;
        }
    }
    static boolean isPrime(int n) {
        if (n <= 1)
            return false;
        if (n <= 3)
            return true;
        if (n % 2 == 0 ||
            n % 3 == 0)
            return false;

        for (int i = 5;
                 i * i <= n; i = i + 6)
            if (n % i == 0 ||
                n % (i + 2) == 0)
                return false;

        return true;
    }
    static long gcd(long a, long b) {
      if (b == 0)
        return a;
      return gcd(b, a % b);
    }
    static long modInverse(long a, long m) {
        long g = gcd(a, m);
        if (g != 1)
            return -1;
        else{
            // If a and m are relatively prime, then modulo inverse
            // is a^(m-2) mode m
            return (power(a, m - 2, m));
        }
    }

    // To compute x^y under modulo m
    static long power(long x, long y, long m){
        if (y == 0)
            return 1;
        long p = power(x, y / 2, m) % m;
        p = (p * p) % m;

        if (y % 2 == 0)
            return p;
        else
            return (x * p) % m;
    }
    static long fast_pow(long base,long n,long M){
        if(n==0)
           return 1;
        if(n==1)
        return base;
        long halfn=fast_pow(base,n/2,M);
        if(n%2==0)
            return ( halfn * halfn ) % M;
        else
            return ( ( ( halfn * halfn ) % M ) * base ) % M;
    }
       static long modInverse(long n,int M){
        return fast_pow(n,M-2,M);
    }

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author root
 */
public class C {

    public static void main(String args[]) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int a[] = new int[n];
        String tokens[] = br.readLine().split(" ");
        for(int i = 0;i<n;i++) a[i] = Integer.parseInt(tokens[i]);
        long res = getMaxOfFunction(a);
        System.out.println(res);
    }

    private static long getMaxOfFunction(int a[]){

        long b[] = new long[a.length];
        long c[] = new long[a.length];
        int one = 1;
        for(int i = 0;i<a.length-1;i++){
           b[i] = Math.abs((long)(a[i+1]-a[i]))*one;
           c[i] = -b[i];
           one*=-1;
        }
        return Math.max(getMaxSegmentSum(b), getMaxSegmentSum(c));
    }

    private static long getMaxSegmentSum(long b[]){
        long prefMin = 0, prefMax = 0, prefSum = 0;
        for(int i = 0;i<b.length;i++){
            prefSum+=b[i];
            prefMin= Math.min(prefSum, prefMin);
            prefMax = Math.max(prefSum, prefMax);
        }
        return prefMax-prefMin;
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author root
 */
public class C {

    public static void main(String args[]) throws IOException{
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        int a[] = new int[n];
        String tokens[] = br.readLine().split(" ");
        for(int i = 0;i<n;i++) a[i] = Integer.parseInt(tokens[i]);
        int res = getMaxOfFunction(a);
        System.out.println(res);
    }

    private static int getMaxOfFunction(int a[]){

        int b[] = new int[a.length];
        int c[] = new int[a.length];
        int one = 1;
        for(int i = 0;i<a.length-1;i++){
           b[i] = Math.abs(a[i+1]-a[i])*one;
           c[i] = -b[i];
           one*=-1;
        }
        return Math.max(getMaxSegmentSum(b), getMaxSegmentSum(c));
    }

    private static int getMaxSegmentSum(int b[]){
        int prefMin = 0, prefMax = 0, prefSum = 0;
        for(int i = 0;i<b.length;i++){
            prefSum+=b[i];
            prefMin= Math.min(prefSum, prefMin);
            prefMax = Math.max(prefSum, prefMax);
        }
        return prefMax-prefMin;
    }
}


import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class C407 {
	public static void main(String args[]) throws FileNotFoundException {
		InputReader in = new InputReader(System.in);
		OutputStream outputStream = System.out;
		PrintWriter out = new PrintWriter(outputStream);
		StringBuilder sb = new StringBuilder();
		// ----------My Code----------
		int n = in.nextInt();
		long arr[] = in.nextLongArray(n, 0);

		long diff[] = new long[n - 1];
		for (int i = 0; i < n - 1; i++) {
			diff[i] = (int) Math.abs(arr[i + 1] - arr[i]);
			if(i%2==0)
				diff[i]=-diff[i];
		}

		long ans1=maxSubArraySum(diff);
		for (int i = 0; i < n - 1; i++) {
			diff[i]=-diff[i];
		}
		long ans2=maxSubArraySum(diff);
		out.println(Math.max(ans1, ans2));
		// ---------------The End------------------

		out.close();
	}

	static long maxSubArraySum(long a[]) {
		int size = a.length;
		long max_so_far = Long.MIN_VALUE, max_ending_here = 0;

		for (int i = 0; i < size; i++) {
			max_ending_here = max_ending_here + a[i];
			if (max_so_far < max_ending_here)
				max_so_far = max_ending_here;
			if (max_ending_here < 0)
				max_ending_here = 0;
		}
		return max_so_far;
	}
	// ---------------Extra Methods------------------

	public static long pow(long x, long n, long mod) {
		long res = 1;
		x %= mod;
		while (n > 0) {
			if (n % 2 == 1) {
				res = (res * x) % mod;
			}
			x = (x * x) % mod;
			n /= 2;
		}
		return res;
	}

	public static boolean isPal(String s) {
		for (int i = 0, j = s.length() - 1; i <= j; i++, j--) {
			if (s.charAt(i) != s.charAt(j))
				return false;
		}
		return true;
	}

	public static String rev(String s) {
		StringBuilder sb = new StringBuilder(s);
		sb.reverse();
		return sb.toString();
	}

	public static long gcd(long x, long y) {
		if (x % y == 0)
			return y;
		else
			return gcd(y, x % y);
	}

	public static int gcd(int x, int y) {
		if (x % y == 0)
			return y;
		else
			return gcd(y, x % y);
	}

	public static long gcdExtended(long a, long b, long[] x) {

		if (a == 0) {
			x[0] = 0;
			x[1] = 1;
			return b;
		}
		long[] y = new long[2];
		long gcd = gcdExtended(b % a, a, y);

		x[0] = y[1] - (b / a) * y[0];
		x[1] = y[0];

		return gcd;
	}

	public static int abs(int a, int b) {
		return (int) Math.abs(a - b);
	}

	public static long abs(long a, long b) {
		return (long) Math.abs(a - b);
	}

	public static int max(int a, int b) {
		if (a > b)
			return a;
		else
			return b;
	}

	public static int min(int a, int b) {
		if (a > b)
			return b;
		else
			return a;
	}

	public static long max(long a, long b) {
		if (a > b)
			return a;
		else
			return b;
	}

	public static long min(long a, long b) {
		if (a > b)
			return b;
		else
			return a;
	}
	// ---------------Extra Methods------------------

	public static void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream inputstream) {
			reader = new BufferedReader(new InputStreamReader(inputstream));
			tokenizer = null;
		}

		public String nextLine() {
			String fullLine = null;
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					fullLine = reader.readLine();
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
				return fullLine;
			}
			return fullLine;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public char nextChar() {
			return next().charAt(0);
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n, int f) {
			if (f == 0) {
				int[] arr = new int[n];
				for (int i = 0; i < n; i++) {
					arr[i] = nextInt();
				}
				return arr;
			} else {
				int[] arr = new int[n + 1];
				for (int i = 1; i < n + 1; i++) {
					arr[i] = nextInt();
				}
				return arr;
			}
		}

		public long[] nextLongArray(int n, int f) {
			if (f == 0) {
				long[] arr = new long[n];
				for (int i = 0; i < n; i++) {
					arr[i] = nextLong();
				}
				return arr;
			} else {
				long[] arr = new long[n + 1];
				for (int i = 1; i < n + 1; i++) {
					arr[i] = nextLong();
				}
				return arr;
			}

		}

		public double[] nextDoubleArray(int n, int f) {
			if (f == 0) {
				double[] arr = new double[n];
				for (int i = 0; i < n; i++) {
					arr[i] = nextDouble();
				}
				return arr;
			} else {
				double[] arr = new double[n + 1];
				for (int i = 1; i < n + 1; i++) {
					arr[i] = nextDouble();
				}
				return arr;
			}
		}

	}

	static class Pair implements Comparable<Pair> {
		int a, b;

		Pair(int a, int b) {
			this.a = a;
			this.b = b;
		}

		public int compareTo(Pair o) {
			// TODO Auto-generated method stub
			if (this.a != o.a)
				return Integer.compare(this.a, o.a);
			else
				return Integer.compare(this.b, o.b);
		}

		public boolean equals(Object o) {
			if (o instanceof Pair) {
				Pair p = (Pair) o;
				return p.a == a && p.b == b;
			}
			return false;
		}

		public int hashCode() {
			return new Integer(a).hashCode() * 31 + new Integer(b).hashCode();
		}

	}

}


import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.StringTokenizer;

public class C407 {
	public static void main(String args[]) throws FileNotFoundException {
		InputReader in = new InputReader(System.in);
		OutputStream outputStream = System.out;
		PrintWriter out = new PrintWriter(outputStream);
		StringBuilder sb = new StringBuilder();
		// ----------My Code----------
		int n = in.nextInt();
		long arr[] = in.nextLongArray(n, 0);

		int diff[] = new int[n - 1];
		for (int i = 0; i < n - 1; i++) {
			diff[i] = (int) Math.abs(arr[i + 1] - arr[i]);
			if(i%2==0)
				diff[i]=-diff[i];
		}

		long ans1=maxSubArraySum(diff);
		for (int i = 0; i < n - 1; i++) {
			diff[i]=-diff[i];
		}
		long ans2=maxSubArraySum(diff);
		out.println(Math.max(ans1, ans2));
		// ---------------The End------------------

		out.close();
	}

	static int maxSubArraySum(int a[]) {
		int size = a.length;
		int max_so_far = Integer.MIN_VALUE, max_ending_here = 0;

		for (int i = 0; i < size; i++) {
			max_ending_here = max_ending_here + a[i];
			if (max_so_far < max_ending_here)
				max_so_far = max_ending_here;
			if (max_ending_here < 0)
				max_ending_here = 0;
		}
		return max_so_far;
	}
	// ---------------Extra Methods------------------

	public static long pow(long x, long n, long mod) {
		long res = 1;
		x %= mod;
		while (n > 0) {
			if (n % 2 == 1) {
				res = (res * x) % mod;
			}
			x = (x * x) % mod;
			n /= 2;
		}
		return res;
	}

	public static boolean isPal(String s) {
		for (int i = 0, j = s.length() - 1; i <= j; i++, j--) {
			if (s.charAt(i) != s.charAt(j))
				return false;
		}
		return true;
	}

	public static String rev(String s) {
		StringBuilder sb = new StringBuilder(s);
		sb.reverse();
		return sb.toString();
	}

	public static long gcd(long x, long y) {
		if (x % y == 0)
			return y;
		else
			return gcd(y, x % y);
	}

	public static int gcd(int x, int y) {
		if (x % y == 0)
			return y;
		else
			return gcd(y, x % y);
	}

	public static long gcdExtended(long a, long b, long[] x) {

		if (a == 0) {
			x[0] = 0;
			x[1] = 1;
			return b;
		}
		long[] y = new long[2];
		long gcd = gcdExtended(b % a, a, y);

		x[0] = y[1] - (b / a) * y[0];
		x[1] = y[0];

		return gcd;
	}

	public static int abs(int a, int b) {
		return (int) Math.abs(a - b);
	}

	public static long abs(long a, long b) {
		return (long) Math.abs(a - b);
	}

	public static int max(int a, int b) {
		if (a > b)
			return a;
		else
			return b;
	}

	public static int min(int a, int b) {
		if (a > b)
			return b;
		else
			return a;
	}

	public static long max(long a, long b) {
		if (a > b)
			return a;
		else
			return b;
	}

	public static long min(long a, long b) {
		if (a > b)
			return b;
		else
			return a;
	}
	// ---------------Extra Methods------------------

	public static void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	static class InputReader {
		public BufferedReader reader;
		public StringTokenizer tokenizer;

		public InputReader(InputStream inputstream) {
			reader = new BufferedReader(new InputStreamReader(inputstream));
			tokenizer = null;
		}

		public String nextLine() {
			String fullLine = null;
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					fullLine = reader.readLine();
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
				return fullLine;
			}
			return fullLine;
		}

		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(reader.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}

		public char nextChar() {
			return next().charAt(0);
		}

		public long nextLong() {
			return Long.parseLong(next());
		}

		public int nextInt() {
			return Integer.parseInt(next());
		}

		public double nextDouble() {
			return Double.parseDouble(next());
		}

		public int[] nextIntArray(int n, int f) {
			if (f == 0) {
				int[] arr = new int[n];
				for (int i = 0; i < n; i++) {
					arr[i] = nextInt();
				}
				return arr;
			} else {
				int[] arr = new int[n + 1];
				for (int i = 1; i < n + 1; i++) {
					arr[i] = nextInt();
				}
				return arr;
			}
		}

		public long[] nextLongArray(int n, int f) {
			if (f == 0) {
				long[] arr = new long[n];
				for (int i = 0; i < n; i++) {
					arr[i] = nextLong();
				}
				return arr;
			} else {
				long[] arr = new long[n + 1];
				for (int i = 1; i < n + 1; i++) {
					arr[i] = nextLong();
				}
				return arr;
			}

		}

		public double[] nextDoubleArray(int n, int f) {
			if (f == 0) {
				double[] arr = new double[n];
				for (int i = 0; i < n; i++) {
					arr[i] = nextDouble();
				}
				return arr;
			} else {
				double[] arr = new double[n + 1];
				for (int i = 1; i < n + 1; i++) {
					arr[i] = nextDouble();
				}
				return arr;
			}
		}

	}

	static class Pair implements Comparable<Pair> {
		int a, b;

		Pair(int a, int b) {
			this.a = a;
			this.b = b;
		}

		public int compareTo(Pair o) {
			// TODO Auto-generated method stub
			if (this.a != o.a)
				return Integer.compare(this.a, o.a);
			else
				return Integer.compare(this.b, o.b);
		}

		public boolean equals(Object o) {
			if (o instanceof Pair) {
				Pair p = (Pair) o;
				return p.a == a && p.b == b;
			}
			return false;
		}

		public int hashCode() {
			return new Integer(a).hashCode() * 31 + new Integer(b).hashCode();
		}

	}

}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class FunctionsAgain {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        int n = Integer.parseInt(br.readLine());
        int[] array = new int[n];
        StringTokenizer st = new StringTokenizer(br.readLine());
        for (int i = 0; i < n; i++) {
            array[i] = Integer.parseInt(st.nextToken());
        }

        int[] absDiff = new int[n];
        for (int i = 1; i < n; i++) {
            absDiff[i] = Math.abs(array[i] - array[i - 1]);
        }
        int[][] dp = new int[n][2];
        for (int i = 0; i < n; i++) {
            dp[i][0] = Integer.MIN_VALUE;
            dp[i][1] = Integer.MIN_VALUE;
        }
        dp[1][0] = absDiff[1];
        int max = absDiff[1];
        for (int i = 2; i < n; i++) {
            dp[i][1] = Math.max(dp[i][1], dp[i - 1][0] - absDiff[i]);
            dp[i][0] = absDiff[i];
            if (dp[i - 1][1] != Integer.MIN_VALUE) {
                dp[i][0] = Math.max(dp[i][0], dp[i - 1][1] + absDiff[i]);
            }
            max = Math.max(max, dp[i][0]);
            max = Math.max(max, dp[i][1]);
        }
        System.out.println(max);
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class FunctionsAgain {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out);

        int n = Integer.parseInt(br.readLine());
        int[] array = new int[n];
        StringTokenizer st = new StringTokenizer(br.readLine());
        for (int i = 0; i < n; i++) {
            array[i] = Integer.parseInt(st.nextToken());
        }

        int[] absDiff = new int[n];
        for (int i = 1; i < n; i++) {
            absDiff[i] = Math.abs(array[i] - array[i - 1]);
        }
        int[][] dp = new int[n][2];
        for (int i = 0; i < n; i++) {
            dp[i][0] = Integer.MIN_VALUE;
            dp[i][1] = Integer.MIN_VALUE;
        }
        int max = Integer.MIN_VALUE;
        dp[0][0] = array[0];
        for (int i = 1; i < n; i++) {
            dp[i][1] = Math.max(dp[i][1], dp[i - 1][0] - absDiff[i]);
            dp[i][0] = absDiff[i];
            if (dp[i - 1][1] != Integer.MIN_VALUE) {
                dp[i][0] = Math.max(dp[i][0], dp[i - 1][1] + absDiff[i]);
            }
            max = Math.max(max, dp[i][0]);
            max = Math.max(max, dp[i][1]);
        }
        System.out.println(max);
    }
}


import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class FunctionsAgain {
    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

        int n = Integer.parseInt(br.readLine());
        int[] array = new int[n];
        StringTokenizer st = new StringTokenizer(br.readLine());
        for (int i = 0; i < n; i++) {
            array[i] = Integer.parseInt(st.nextToken());
        }

        int[] absDiff = new int[n];
        for (int i = 1; i < n; i++) {
            absDiff[i] = Math.abs(array[i] - array[i - 1]);
        }
        long[][] dp = new long[n][2];
        for (int i = 0; i < n; i++) {
            dp[i][0] = Long.MIN_VALUE;
            dp[i][1] = Long.MIN_VALUE;
        }
        dp[1][0] = absDiff[1];
        long max = absDiff[1];
        for (int i = 2; i < n; i++) {
            dp[i][1] = Math.max(dp[i][1], dp[i - 1][0] - absDiff[i]);
            dp[i][0] = absDiff[i];
            if (dp[i - 1][1] != Long.MIN_VALUE) {
                dp[i][0] = Math.max(dp[i][0], dp[i - 1][1] + absDiff[i]);
            }
            max = Math.max(max, dp[i][0]);
            max = Math.max(max, dp[i][1]);
        }
        System.out.println(max);
    }
}


import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class codeforces implements Runnable
{
	static class InputReader
	{
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;
		private SpaceCharFilter filter;

		public InputReader(InputStream stream)
		{
			this.stream = stream;
		}

		public int read()
		{
			if (numChars==-1)
				throw new InputMismatchException();

			if (curChar >= numChars)
			{
				curChar = 0;
				try
				{
					numChars = stream.read(buf);
				}
				catch (IOException e)
				{
					throw new InputMismatchException();
				}

				if(numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public String nextLine()
		{
			BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
			String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
		}
		public int nextInt()
		{
			int c = read();

			while(isSpaceChar(c))
				c = read();

			int sgn = 1;

			if (c == '-')
			{
				sgn = -1;
				c = read();
			}

			int res = 0;
			do
			{
				if(c<'0'||c>'9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			while (!isSpaceChar(c));

			return res * sgn;
		}

		public long nextLong()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-')
			{
				sgn = -1;
				c = read();
			}
			long res = 0;

			do
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			while (!isSpaceChar(c));
				return res * sgn;
		}

		public double nextDouble()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-')
			{
				sgn = -1;
				c = read();
			}
			double res = 0;
			while (!isSpaceChar(c) && c != '.')
			{
				if (c == 'e' || c == 'E')
					return res * Math.pow(10, nextInt());
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			if (c == '.')
			{
				c = read();
				double m = 1;
				while (!isSpaceChar(c))
				{
					if (c == 'e' || c == 'E')
						return res * Math.pow(10, nextInt());
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					m /= 10;
					res += (c - '0') * m;
					c = read();
				}
			}
			return res * sgn;
		}

		public String readString()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do
			{
				res.appendCodePoint(c);
				c = read();
			}
			while (!isSpaceChar(c));

			return res.toString();
		}

		public boolean isSpaceChar(int c)
		{
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public String next()
		{
			return readString();
		}

		public interface SpaceCharFilter
		{
			public boolean isSpaceChar(int ch);
		}
	}

	public static void main(String args[]) throws Exception
	{
		new Thread(null, new codeforces(),"codeforces",1<<26).start();
	}

	public void run() {

		InputReader s = new InputReader(System.in);
		PrintWriter w = new PrintWriter(System.out);

		int n = s.nextInt();

		long[] temp = new long[n];
		long[] a = new long[n - 1];

		for(int i = 0; i < n; i++)
			temp[i] = s.nextInt();

		int f = 1;

		for(int i = 0; i < n - 1; i++) {
			a[i] = f * Math.abs(temp[i + 1] - temp[i]); f = -f;
		}

		long max = a[0];
		long maxEndingHere = a[0];

		for(int i = 1; i < n - 1; i++) {

			maxEndingHere = Math.max(maxEndingHere + a[i], a[i]);

			if(max < maxEndingHere)
				max = maxEndingHere;
		}

		w.println(max);

		w.close();
	}

}


import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class codeforces implements Runnable
{
	static class InputReader
	{
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;
		private SpaceCharFilter filter;

		public InputReader(InputStream stream)
		{
			this.stream = stream;
		}

		public int read()
		{
			if (numChars==-1)
				throw new InputMismatchException();

			if (curChar >= numChars)
			{
				curChar = 0;
				try
				{
					numChars = stream.read(buf);
				}
				catch (IOException e)
				{
					throw new InputMismatchException();
				}

				if(numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public String nextLine()
		{
			BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
			String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
		}
		public int nextInt()
		{
			int c = read();

			while(isSpaceChar(c))
				c = read();

			int sgn = 1;

			if (c == '-')
			{
				sgn = -1;
				c = read();
			}

			int res = 0;
			do
			{
				if(c<'0'||c>'9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			while (!isSpaceChar(c));

			return res * sgn;
		}

		public long nextLong()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-')
			{
				sgn = -1;
				c = read();
			}
			long res = 0;

			do
			{
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			while (!isSpaceChar(c));
				return res * sgn;
		}

		public double nextDouble()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			int sgn = 1;
			if (c == '-')
			{
				sgn = -1;
				c = read();
			}
			double res = 0;
			while (!isSpaceChar(c) && c != '.')
			{
				if (c == 'e' || c == 'E')
					return res * Math.pow(10, nextInt());
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c - '0';
				c = read();
			}
			if (c == '.')
			{
				c = read();
				double m = 1;
				while (!isSpaceChar(c))
				{
					if (c == 'e' || c == 'E')
						return res * Math.pow(10, nextInt());
					if (c < '0' || c > '9')
						throw new InputMismatchException();
					m /= 10;
					res += (c - '0') * m;
					c = read();
				}
			}
			return res * sgn;
		}

		public String readString()
		{
			int c = read();
			while (isSpaceChar(c))
				c = read();
			StringBuilder res = new StringBuilder();
			do
			{
				res.appendCodePoint(c);
				c = read();
			}
			while (!isSpaceChar(c));

			return res.toString();
		}

		public boolean isSpaceChar(int c)
		{
			if (filter != null)
				return filter.isSpaceChar(c);
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		public String next()
		{
			return readString();
		}

		public interface SpaceCharFilter
		{
			public boolean isSpaceChar(int ch);
		}
	}

	public static void main(String args[]) throws Exception
	{
		new Thread(null, new codeforces(),"codeforces",1<<26).start();
	}

	public void run() {

		InputReader s = new InputReader(System.in);
		PrintWriter w = new PrintWriter(System.out);

		int n = s.nextInt();

		long[] temp = new long[n];
		long[] a = new long[n - 1];
		long[] b = new long[n - 1];

		for(int i = 0; i < n; i++)
			temp[i] = s.nextInt();

		int f = 1;

		for(int i = 0; i < n - 1; i++) {
			a[i] =  f * Math.abs(temp[i + 1] - temp[i]); f = -f;
		}

		f = -1;

		for(int i = 0; i < n - 1; i++) {
			b[i] =  f * Math.abs(temp[i + 1] - temp[i]); f = -f;
		}

		long max1 = 0;
		long maxEndingHere = 0;

		for(int i = 0; i < n - 1; i++) {

			maxEndingHere = Math.max(maxEndingHere + a[i], a[i]);
			max1 = Math.max(maxEndingHere, max1);
		}

		long max2 = 0;
		maxEndingHere = 0;

		for(int i = 0; i < n - 1; i++) {

			maxEndingHere = Math.max(maxEndingHere + b[i], b[i]);
			max2 = Math.max(maxEndingHere, max2);
		}

		w.println(Math.max(max1, max2));

		w.close();
	}

}


import java.io.*;
import java.util.*;

public class TestClass
{
	static PrintWriter out = new PrintWriter(System.out);
	public static void main(String args[]) throws Exception
	{
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(in.readLine());
		String s[] = in.readLine().split(" ");
		int a[] = new int[n];
		for(int i=0;i<n;i++)
		{
			a[i] = Integer.parseInt(s[i]);
		}
		int b[] = new int[n-1];
		for(int i=1;i<n;i++)
		{
			if(i%2!=0)
			{
				b[i-1] = Math.abs(a[i]-a[i-1]);
			}
			else
			{
				b[i-1] = -Math.abs(a[i]-a[i-1]);
			}
			//System.out.println(b[i-1]);
		}
		int max =Integer.MIN_VALUE,sum=0;
	    for(int i=0;i<n-1;i++)
	    {
	        sum += b[i];
	        max = Math.max(sum,max);

	        if(sum<0)
	        {
	            sum=0;
	        }
	    }
	    out.println(max);
		out.close();
	}

}


import java.io.*;
import java.util.*;

public class TestClass
{
	static PrintWriter out = new PrintWriter(System.out);
	public static void main(String args[]) throws Exception
	{
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(in.readLine());
		String s[] = in.readLine().split(" ");
		int a[] = new int[n];
		for(int i=0;i<n;i++)
		{
			a[i] = Integer.parseInt(s[i]);
		}
		int b[] = new int[n-1];
		int c[] = new int[n-1];
		for(int i=1;i<n;i++)
		{
			if(i%2!=0)
			{
				b[i-1] = Math.abs(a[i]-a[i-1]);
				c[i-1] = -Math.abs(a[i]-a[i-1]);
			}
			else
			{
				b[i-1] = -Math.abs(a[i]-a[i-1]);
				c[i-1] = Math.abs(a[i]-a[i-1]);
			}
			//System.out.println(b[i-1]);
		}
		int max =Integer.MIN_VALUE,sum=0;
	    for(int i=0;i<n-1;i++)
	    {
	        sum += b[i];
	        max = Math.max(sum,max);

	        if(sum<0)
	        {
	            sum=0;
	        }
	    }
	    sum=0;
	    for(int i=0;i<n-1;i++)
	    {
	        sum += c[i];
	        max = Math.max(sum,max);

	        if(sum<0)
	        {
	            sum=0;
	        }
	    }
	    out.println(max);
		out.close();
	}

}


import java.io.*;
import java.util.*;

public class TestClass
{
	static PrintWriter out = new PrintWriter(System.out);
	public static void main(String args[]) throws Exception
	{
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(in.readLine());
		String s[] = in.readLine().split(" ");
		long a[] = new long[n];
		for(int i=0;i<n;i++)
		{
			a[i] = Long.parseLong(s[i]);
		}
		long b[] = new long[n-1];
		long c[] = new long[n-1];
		for(int i=1;i<n;i++)
		{
			if(i%2!=0)
			{
				b[i-1] = Math.abs(a[i]-a[i-1]);
				c[i-1] = -Math.abs(a[i]-a[i-1]);
			}
			else
			{
				b[i-1] = -Math.abs(a[i]-a[i-1]);
				c[i-1] = Math.abs(a[i]-a[i-1]);
			}
			//System.out.println(b[i-1]);
		}
		long max =Long.MIN_VALUE,sum=0;
	    for(int i=0;i<n-1;i++)
	    {
	        sum += b[i];
	        max = Math.max(sum,max);

	        if(sum<0)
	        {
	            sum=0;
	        }
	    }
	    sum=0;
	    for(int i=0;i<n-1;i++)
	    {
	        sum += c[i];
	        max = Math.max(sum,max);

	        if(sum<0)
	        {
	            sum=0;
	        }
	    }
	    out.println(max);
		out.close();
	}

}


import java.util.Scanner;

public class Frodo {
	static long max(int[] a) {
		long maxsofar = 0, maxhere = 0;
		for (int i = 0; i < a.length; i++) {
			maxhere = Math.max(maxhere + a[i], 0);
			maxsofar = Math.max(maxsofar, maxhere);
		}
		return maxsofar;
	}

	static int[] arr, a1, a2;

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		arr = new int[n];
		for (int i = 0; i < n; i++) {
			arr[i] = in.nextInt();
		}
		a1 = new int[n];
		a2 = new int[n];
		for (int i = 0; i < n - 1; i++) {
			a1[i] = Math.abs(arr[i] - arr[i + 1]) * ((i % 2) == 0 ? -1 : 1);
			a2[i] = Math.abs(arr[i] - arr[i + 1]) * ((i % 2) == 1 ? -1 : 1);
		}
		System.out.println(Math.max(max(a1), max(a2)));
	}
}


import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;

public class Main {
	static class Reader
    {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader()
        {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String file_name) throws IOException
        {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException
        {
            byte[] buf = new byte[256]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1)
            {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException
        {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do
            {
                ret = ret * 10 + c - '0';
            }  while ((c = read()) >= '0' && c <= '9');

            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong() throws IOException
        {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble() throws IOException
        {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();

            do {
                ret = ret * 10 + c - '0';
            }
            while ((c = read()) >= '0' && c <= '9');

            if (c == '.')
            {
                while ((c = read()) >= '0' && c <= '9')
                {
                    ret += (c - '0') / (div *= 10);
                }
            }

            if (neg)
                return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException
        {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws IOException
        {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException
        {
            if (din == null)
                return;
            din.close();
        }
    }

	public static void main(String args[])throws IOException{
		Reader in = new Reader();
		int n = in.nextInt();
		long a[]=new long[n];
		for(int i=0;i<n;i++)
			a[i]=in.nextLong();
		for(int i=0;i<n-1;i++){
			a[i]=(long)Math.abs(a[i+1]-a[i]);
			if(i%2==1)
				a[i]=-a[i];
		}
		long max=-1;
		long max_so_far=0;
		for(int i=0;i<n-1;i++){
			max_so_far+=a[i];
			if(max_so_far<0)
				max_so_far=0;
			if(max_so_far>max)
				max=max_so_far;
		}
		for(int i=0;i<n-1;i++)
			a[i]=-a[i];
		max_so_far=0;
		for(int i=0;i<n-1;i++){
			max_so_far+=a[i];
			if(max_so_far<0)
				max_so_far=0;
			if(max_so_far>max)
				max=max_so_far;
		}
		System.out.println(max);
	}
}


import java.util.Arrays;
import java.util.Scanner;

public class Prob3 {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		long[] a = new long[n-1];
		long last = in.nextLong();
		for (int i = 1; i < n; i++) {
			long current = in.nextLong();
			a[i-1] = Math.abs(last - current);
			last = current;
		}
		long max = 0;
		long sum = 0;
		for (int i = 0; i < n-1; i++) {
			if (sum < 0) sum = 0;
			if (i%2 == 0) sum += a[i];
			else sum -= a[i];
			if (sum > max) max = sum;
		}
		for (int i = 0; i < n-1; i++) {
			if (sum < 0) sum = 0;
			if (i%2 == 1) sum += a[i];
			else sum -= a[i];
			if (sum > max) max = sum;
		}
		System.out.println(max);
	}

}


import java.util.Arrays;
import java.util.Scanner;

public class Prob3 {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		long[] a = new long[n-1];
		long last = in.nextLong();
		for (int i = 1; i < n; i++) {
			long current = in.nextLong();
			a[i-1] = Math.abs(last - current);
			last = current;
		}
		long max = 0;
		long sum = 0;
		for (int i = 0; i < n-1; i++) {
			if (sum < 0) sum = 0;
			if (i%2 == 0) sum += a[i];
			else sum -= a[i];
			if (sum > max) max = sum;
		}
		sum = 0;
		for (int i = 0; i < n-1; i++) {
			if (sum < 0) sum = 0;
			if (i%2 == 1) sum += a[i];
			else sum -= a[i];
			if (sum > max) max = sum;
		}
		System.out.println(max);
	}

}


import java.io.*;
import java.util.*;
public final class round_407_c
{
    static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	static FastScanner sc=new FastScanner(br);
    static PrintWriter out=new PrintWriter(System.out);
	static Random rnd=new Random();
	static long[][] bit;
	static int n;

	static void update(int idx1,int idx2,long val)
	{
		while(idx2<=n)
		{
			bit[idx1][idx2]=Math.min(bit[idx1][idx2],val);idx2+=idx2&-idx2;
		}
	}

	static long query(int idx1,int idx2)
	{
		long ret=0;

		while(idx2>0)
		{
			ret=Math.min(ret,bit[idx1][idx2]);idx2-=idx2&-idx2;
		}

		return ret;
	}

    public static void main(String args[]) throws Exception
    {
		n=sc.nextInt(); long[] a=new long[n+1]; bit=new long[2][n+1];

		for(int i=1;i<=n;i++)
		{
			a[i]=sc.nextLong();
		}

		long[][] pre=new long[2][n+1];int x=1;long sum=0;

		for(int i=2;i<=n;i++)
		{
			long curr=Math.abs(a[i]-a[i-1])*x;sum+=curr;

			pre[0][i]=sum;x*=-1;
		}

		sum=0;x=1;

		for(int i=3;i<=n;i++)
		{
			long curr=Math.abs(a[i]-a[i-1])*x;sum+=curr;

			pre[1][i]=sum;x*=-1;
		}

	//	out.println(Arrays.toString(pre[0])+" "+Arrays.toString(pre[1]));

		long max=Long.MIN_VALUE;

		for(int i=2;i<=n;i++)
		{
			// try and subtract from each of them elements at dis%2==0;

			long now=pre[0][i],val=query(i%2,i-2);

			max=Math.max(max,now-val);

			update(i%2,i,pre[0][i]);
		}

		bit=new long[2][n+1];

		for(int i=3;i<=n;i++)
		{
			long now=pre[1][i],val=query(1-(i%2),i-2);

			max=Math.max(max,now-val);

			update(i%2,i,pre[1][i]);
		}

		out.println(max);out.close();

    }
}
class FastScanner
{
    BufferedReader in;
    StringTokenizer st;

    public FastScanner(BufferedReader in) {
        this.in = in;
    }

    public String nextToken() throws Exception {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }

	public String next() throws Exception {
		return nextToken().toString();
	}

    public int nextInt() throws Exception {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() throws Exception {
        return Long.parseLong(nextToken());
    }

    public double nextDouble() throws Exception {
        return Double.parseDouble(nextToken());
    }
}


import java.io.*;
import java.util.*;
public final class abcd
{
    static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	static FastScanner sc=new FastScanner(br);
    static PrintWriter out=new PrintWriter(System.out);
	static Random rnd=new Random();
	static long[][] bit;
	static int n;

	static void update(int idx1,int idx2,long val)
	{
		while(idx2<=n)
		{
			bit[idx1][idx2]=Math.min(bit[idx1][idx2],val);idx2+=idx2&-idx2;
		}
	}

	static long query(int idx1,int idx2)
	{
		long ret=0;

		while(idx2>0)
		{
			ret=Math.min(ret,bit[idx1][idx2]);idx2-=idx2&-idx2;
		}

		return ret;
	}

    public static void main(String args[]) throws Exception
    {
		n=sc.nextInt(); long[] a=new long[n+1]; bit=new long[2][n+1];

		for(int i=1;i<=n;i++)
		{
			a[i]=sc.nextLong();
		}

		long[][] pre=new long[2][n+1];int x=1;long sum=0;

		for(int i=2;i<=n;i++)
		{
			long curr=Math.abs(a[i]-a[i-1])*x;sum+=curr;

			pre[0][i]=sum;x*=-1;
		}

		sum=0;x=1;

		for(int i=3;i<=n;i++)
		{
			long curr=Math.abs(a[i]-a[i-1])*x;sum+=curr;

			pre[1][i]=sum;x*=-1;
		}

		long max=Long.MIN_VALUE;

		for(int i=2;i<=n;i++)
		{
		    if(i%2==0)
		    {
    			long now=pre[0][i],val=query(1-(i%2),i-1);

    			max=Math.max(max,now-val);
		    }
		    else
		    {
				long now=pre[0][i],val=query(i%2,i-1);

				max=Math.max(max,now-val);
			}

			update(i%2,i,pre[0][i]);
		}

		bit=new long[2][n+1];

		for(int i=3;i<=n;i++)
		{
			if(i%2==0)
		    {
    			long now=pre[1][i],val=query(i%2,i-1);

    			max=Math.max(max,now-val);
		    }
		    else
		    {
				long now=pre[1][i],val=query(1-(i%2),i-1);

				max=Math.max(max,now-val);
			}

			update(i%2,i,pre[1][i]);
		}

		out.println(max);out.close();

    }
}
class FastScanner
{
    BufferedReader in;
    StringTokenizer st;

    public FastScanner(BufferedReader in) {
        this.in = in;
    }

    public String nextToken() throws Exception {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }

	public String next() throws Exception {
		return nextToken().toString();
	}

    public int nextInt() throws Exception {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() throws Exception {
        return Long.parseLong(nextToken());
    }

    public double nextDouble() throws Exception {
        return Double.parseDouble(nextToken());
    }
}


import java.io.*;
import java.util.*;
public final class round_407_c
{
    static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	static FastScanner sc=new FastScanner(br);
    static PrintWriter out=new PrintWriter(System.out);
	static Random rnd=new Random();
	static long[][] bit;
	static int n;

	static void update(int idx1,int idx2,long val)
	{
		while(idx2<=n)
		{
			bit[idx1][idx2]=Math.min(bit[idx1][idx2],val);idx2+=idx2&-idx2;
		}
	}

	static long query(int idx1,int idx2)
	{
		long ret=0;

		while(idx2>0)
		{
			ret=Math.min(ret,bit[idx1][idx2]);idx2-=idx2&-idx2;
		}

		return ret;
	}

    public static void main(String args[]) throws Exception
    {
		n=sc.nextInt(); long[] a=new long[n+1]; bit=new long[2][n+1];

		for(int i=1;i<=n;i++)
		{
			a[i]=sc.nextLong();
		}

		long[][] pre=new long[2][n+1];int x=1;long sum=0;long max=Long.MIN_VALUE;

		for(int i=2;i<=n;i++)
		{
			long curr=Math.abs(a[i]-a[i-1])*x;sum+=curr;

			pre[0][i]=sum;x*=-1;

			max=Math.max(max,sum);
		}

		sum=0;x=1;

		for(int i=3;i<=n;i++)
		{
			long curr=Math.abs(a[i]-a[i-1])*x;sum+=curr;

			pre[1][i]=sum;x*=-1; max=Math.max(max,sum);
		}

	//	out.println(Arrays.toString(pre[0])+" "+Arrays.toString(pre[1]));

		for(int i=3;i<=n;i++)
		{
			if(i%2==1)
			{
				long now=pre[0][i],val1=query(i%2,i-1);
				max=Math.max(max,now-val1);update(i%2,i,pre[0][i]);
			}
		}

		bit=new long[2][n+1];

		for(int i=3;i<=n;i++)
		{
			if(i%2==0)
			{
				long now=pre[1][i],val1=query(i%2,i-1);
				max=Math.max(max,now-val1);update(i%2,i,pre[1][i]);
			}
		}

		bit=new long[2][n+1];

		for(int i=3;i<=n;i++)
		{
			if(i%2==0)
			{
				long now=pre[0][i],val1=query(1-(i%2),i-1);

				max=Math.max(max,now-val1);

				update(i%2,i,pre[0][i]);
			}
		}

		bit=new long[2][n+1];

		for(int i=3;i<=n;i++)
		{
			if(i%2==1)
			{
				long now=pre[1][i],val1=query(1-(i%2),i-1);

				max=Math.max(max,now-val1);

				update(i%2,i,pre[1][i]);
			}
		}

		out.println(max);out.close();

    }
}
class FastScanner
{
    BufferedReader in;
    StringTokenizer st;

    public FastScanner(BufferedReader in) {
        this.in = in;
    }

    public String nextToken() throws Exception {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }

	public String next() throws Exception {
		return nextToken().toString();
	}

    public int nextInt() throws Exception {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() throws Exception {
        return Long.parseLong(nextToken());
    }

    public double nextDouble() throws Exception {
        return Double.parseDouble(nextToken());
    }
}


import java.io.*;
import java.util.*;
public final class round_407_c
{
    static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	static FastScanner sc=new FastScanner(br);
    static PrintWriter out=new PrintWriter(System.out);
	static Random rnd=new Random();
	static long[][] bit;
	static int n;

	static void update(int idx1,int idx2,long val)
	{
		while(idx2<=n)
		{
			bit[idx1][idx2]=Math.min(bit[idx1][idx2],val);idx2+=idx2&-idx2;
		}
	}

	static long query(int idx1,int idx2)
	{
		long ret=0;

		while(idx2>0)
		{
			ret=Math.min(ret,bit[idx1][idx2]);idx2-=idx2&-idx2;
		}

		return ret;
	}

    public static void main(String args[]) throws Exception
    {
		n=sc.nextInt(); long[] a=new long[n+1]; bit=new long[2][n+1];

		for(int i=1;i<=n;i++)
		{
			a[i]=sc.nextLong();
		}

		long[][] pre=new long[2][n+1];int x=1;long sum=0;

		for(int i=2;i<=n;i++)
		{
			long curr=Math.abs(a[i]-a[i-1])*x;sum+=curr;

			pre[0][i]=sum;x*=-1;
		}

		sum=0;x=1;

		for(int i=3;i<=n;i++)
		{
			long curr=Math.abs(a[i]-a[i-1])*x;sum+=curr;

			pre[1][i]=sum;x*=-1;
		}

	//	out.println(Arrays.toString(pre[0])+" "+Arrays.toString(pre[1]));

		long max=Long.MIN_VALUE;

		for(int i=2;i<=n;i++)
		{
			long now=pre[0][i],val1=query(i%2,i-1);

			max=Math.max(max,now-val1);

			update(i%2,i,pre[0][i]);
		}

		bit=new long[2][n+1];

		for(int i=3;i<=n;i++)
		{
			long now=pre[1][i],val1=query(1-(i%2),i-1);

			max=Math.max(max,now-val1);

			update(i%2,i,pre[1][i]);
		}

		out.println(max);out.close();

    }
}
class FastScanner
{
    BufferedReader in;
    StringTokenizer st;

    public FastScanner(BufferedReader in) {
        this.in = in;
    }

    public String nextToken() throws Exception {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }

	public String next() throws Exception {
		return nextToken().toString();
	}

    public int nextInt() throws Exception {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() throws Exception {
        return Long.parseLong(nextToken());
    }

    public double nextDouble() throws Exception {
        return Double.parseDouble(nextToken());
    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author wannabe
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public int maxSubArray(int[] A) {
            int max = A[0];
            int[] sum = new int[A.length];
            sum[0] = A[0];

            for (int i = 1; i < A.length; i++) {
                sum[i] = Math.max(A[i], sum[i - 1] + A[i]);
                max = Math.max(max, sum[i]);
            }

            return max;
        }

        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int[] numbers = new int[n];
            for (int i = 0; i < numbers.length; i++) {
                numbers[i] = in.nextInt();
            }

            int[] diffsEven = new int[n - 1];
            int[] diffsOdd = new int[n - 2];

            for (int i = 0; i < numbers.length - 1; i++) {
                diffsEven[i] = Math.abs(numbers[i] - numbers[i + 1]) * (int) Math.pow(-1, i);
                if (i == 0) continue;
                diffsOdd[i - 1] = -1 * diffsEven[i];
            }

            out.print(Math.max(maxSubArray(diffsEven), maxSubArray(diffsOdd)));

        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author wannabe
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public int maxSubArray(int[] A) {
            if (A.length == 0) return -1;
            int max = A[0];
            int[] sum = new int[A.length];
            sum[0] = A[0];

            for (int i = 1; i < A.length; i++) {
                sum[i] = Math.max(A[i], sum[i - 1] + A[i]);
                max = Math.max(max, sum[i]);
            }

            return max;
        }

        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            int[] numbers = new int[n];
            for (int i = 0; i < numbers.length; i++) {
                numbers[i] = in.nextInt();
            }

            int[] diffsEven = new int[n - 1];
            int[] diffsOdd = new int[n - 2];

            for (int i = 0; i < numbers.length - 1; i++) {
                diffsEven[i] = Math.abs(numbers[i] - numbers[i + 1]) * (int) Math.pow(-1, i);
                if (i == 0) continue;
                diffsOdd[i - 1] = -1 * diffsEven[i];
            }

            out.print(Math.max(maxSubArray(diffsEven), maxSubArray(diffsOdd)));

        }

    }
}


import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Scanner;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author wannabe
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        Scanner in = new Scanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public long maxSubArray(long[] A) {
            if (A.length == 0) return -1;
            long max = A[0];
            long[] sum = new long[A.length];
            sum[0] = A[0];

            for (int i = 1; i < A.length; i++) {
                sum[i] = Math.max(A[i], sum[i - 1] + A[i]);
                max = Math.max(max, sum[i]);
            }

            return max;
        }

        public void solve(int testNumber, Scanner in, PrintWriter out) {
            int n = in.nextInt();
            long[] numbers = new long[n];
            for (int i = 0; i < numbers.length; i++) {
                numbers[i] = in.nextLong();
            }

            long[] diffsEven = new long[n - 1];
            long[] diffsOdd = new long[n - 2];

            for (int i = 0; i < numbers.length - 1; i++) {
                diffsEven[i] = Math.abs(numbers[i] - numbers[i + 1]) * (long) Math.pow(-1, i);
                if (i == 0) continue;
                diffsOdd[i - 1] = -1 * diffsEven[i];
            }

            out.print(Math.max(maxSubArray(diffsEven), maxSubArray(diffsOdd)));

        }

    }
}


import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Div2_407_C {
    public static void main(String[] args) throws IOException {
        BufferedInputStream bis = new BufferedInputStream(System.in);
        BufferedReader br = new BufferedReader(new InputStreamReader(bis));
        PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        String input;
        while ((input = br.readLine()) != null && !input.equals("")) {
            int n = Integer.parseInt(input.trim());
            int[] arr = new int[n];
            StringTokenizer st = new StringTokenizer(br.readLine());
            for (int i = 0; i < arr.length; i++) {
                arr[i] = Integer.parseInt(st.nextToken());
            }
            long[] dp = new long[n];
            long ans = 0;
            for (int r = 1; r < arr.length; r++) {
                int sign = r % 2 == 1 ? 1 : -1;
                dp[r] = Math.max(dp[r - 1] + sign * Math.abs(arr[r] - arr[r - 1]), 0);
                ans = Math.max(ans, dp[r]);
            }
            out.println(ans);
        }
        out.close();
        br.close();
    }
}


import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Div2_407_C {
    public static void main(String[] args) throws IOException {
        BufferedInputStream bis = new BufferedInputStream(System.in);
        BufferedReader br = new BufferedReader(new InputStreamReader(bis));
        PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        String input;
        while ((input = br.readLine()) != null && !input.equals("")) {
            int n = Integer.parseInt(input.trim());
            int[] arr = new int[n];
            StringTokenizer st = new StringTokenizer(br.readLine());
            for (int i = 0; i < arr.length; i++) {
                arr[i] = Integer.parseInt(st.nextToken());
            }
            long[] dp = new long[n];
            long ans = 0;
            for (int r = 1; r < arr.length; r++) {
                int sign = r % 2 == 1 ? 1 : -1;
                long toAdd = sign * Math.abs(arr[r] - arr[r - 1]);
                dp[r] = Math.max(dp[r - 1] + toAdd, toAdd);
                ans = Math.max(ans, dp[r]);
            }
            out.println(ans);
        }
        out.close();
        br.close();
    }
}


import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Div2_407_C {
    public static void main(String[] args) throws IOException {
        BufferedInputStream bis = new BufferedInputStream(System.in);
        BufferedReader br = new BufferedReader(new InputStreamReader(bis));
        PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        String input;

        while ((input = br.readLine()) != null && !input.equals("")) {
            int n = Integer.parseInt(input.trim());
            long[] arr = new long[n];
            StringTokenizer st = new StringTokenizer(br.readLine());
            for (int i = 0; i < n; i++) {
                arr[i] = Integer.parseInt(st.nextToken());
            }
            long ans = Math.max(solveDP(arr, 0), solveDP(arr, 1));
            out.println(ans);
        }
        out.close();
        br.close();
    }

    public static long solveDP(long[] input, int v) {
        long[] arr = new long[input.length - 1];
        for (int i = 0; i < input.length - 1; i++)
            arr[i] = Math.abs(input[i] - input[i + 1]) * (i % 2 == v ? 1 : -1);
        long curr = arr[0];
        long ans = arr[0];
        for (int i = 1; i < arr.length; i++) {
            curr = Math.max(curr + arr[i], arr[i]);
            ans = Math.max(ans, curr);
        }
        return ans;
    }
}


import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Div2_407_C2 {
    public static void main(String[] args) throws IOException {
        BufferedInputStream bis = new BufferedInputStream(System.in);
        BufferedReader br = new BufferedReader(new InputStreamReader(bis));
        PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        String input;
        while ((input = br.readLine()) != null && !input.equals("")) {
            int n = Integer.parseInt(input.trim());
            int[] arr = new int[n + 1];
            StringTokenizer st = new StringTokenizer(br.readLine());
            for (int i = 1; i < arr.length; i++) {
                arr[i] = Integer.parseInt(st.nextToken());
            }
            long[] dp = new long[n + 1];
            long ans = 0;
            for (int i = 0; i < 2; i++) {
                for (int r = n - 1; r >= 0; r--) {
                    int sign = r % 2 == i ? 1 : -1;
                    long toAdd = sign * Math.abs(arr[r] - arr[r + 1]);
                    dp[r] = Math.max(dp[r + 1] + toAdd, toAdd);
                    ans = Math.max(ans, dp[r]);
                }
            }
            out.println(ans);
        }
        out.close();
        br.close();
    }
}


import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Div2_407_C2 {
    public static void main(String[] args) throws IOException {
        BufferedInputStream bis = new BufferedInputStream(System.in);
        BufferedReader br = new BufferedReader(new InputStreamReader(bis));
        PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        String input;
        while ((input = br.readLine()) != null && !input.equals("")) {
            int n = Integer.parseInt(input.trim());
            int[] arr = new int[n + 1];
            StringTokenizer st = new StringTokenizer(br.readLine());
            for (int i = 1; i < arr.length; i++) {
                arr[i] = Integer.parseInt(st.nextToken());
            }
            long[] dp = new long[n + 1];
            long ans = Integer.MIN_VALUE;
            for (int i = 0; i < 2; i++) {
                for (int r = n - 1; r >= 0; r--) {
                    int sign = r % 2 == i ? 1 : -1;
                    long toAdd = sign * Math.abs(arr[r] - arr[r + 1]);
                    dp[r] = Math.max(dp[r + 1] + toAdd, toAdd);
                    ans = Math.max(ans, dp[r]);
                }
            }
            out.println(ans);
        }
        out.close();
        br.close();
    }
}


import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Div2_407_C {
    public static void main(String[] args) throws IOException {
        BufferedInputStream bis = new BufferedInputStream(System.in);
        BufferedReader br = new BufferedReader(new InputStreamReader(bis));
        PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        String input;
        while ((input = br.readLine()) != null && !input.equals("")) {
            int n = Integer.parseInt(input.trim());
            int[] arr = new int[n + 1];
            StringTokenizer st = new StringTokenizer(br.readLine());
            for (int i = 1; i < arr.length; i++) {
                arr[i] = Integer.parseInt(st.nextToken());
            }
            long[] dp = new long[n + 1];
            long ans = 0;
            for (int r = n - 1; r >= 0; r--) {
                int sign = r % 2 == 1 ? 1 : -1;
                long toAdd = sign * Math.abs(arr[r] - arr[r + 1]);
                dp[r] = Math.max(dp[r + 1] + toAdd, toAdd);
                ans = Math.max(ans, dp[r]);
            }
            out.println(ans);
        }
        out.close();
        br.close();
    }
}


import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Div2_407_C {
    public static void main(String[] args) throws IOException {
        BufferedInputStream bis = new BufferedInputStream(System.in);
        BufferedReader br = new BufferedReader(new InputStreamReader(bis));
        PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        String input;
        while ((input = br.readLine()) != null && !input.equals("")) {
            int n = Integer.parseInt(input.trim());
            long[] arr = new long[n];
            StringTokenizer st = new StringTokenizer(br.readLine());
            for (int i = 0; i < n; i++) {
                arr[i] = Integer.parseInt(st.nextToken());
            }
            for (int i = 0; i < arr.length - 1; i++)
                arr[i] = Math.abs(arr[i] - arr[i + 1]) * (i % 2 == 0 ? 1 : -1);
            long curr = arr[0];
            long ans = arr[0];
            for (int i = 1; i < arr.length - 1; i++) {
                curr = Math.max(curr + arr[i], arr[i]);
                ans = Math.max(ans, curr);
            }
            out.println(ans);
        }
        out.close();
        br.close();
    }
}


import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Div2_407_C {
    public static void main(String[] args) throws IOException {
        BufferedInputStream bis = new BufferedInputStream(System.in);
        // bis = new BufferedInputStream(new FileInputStream("C.in"));
        BufferedReader br = new BufferedReader(new InputStreamReader(bis));
        PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        // out = new PrintWriter(new File("C.out"));
        String input;

        while ((input = br.readLine()) != null && !input.equals("")) {
            int n = Integer.parseInt(input.trim());
            long[] arr = new long[n];
            StringTokenizer st = new StringTokenizer(br.readLine());
            for (int i = 0; i < n; i++) {
                arr[i] = Integer.parseInt(st.nextToken());
            }
            long ans = solveDP(arr);
            for (int i = 0; i < n; i++) {
                arr[i] *= -1;
            }
            ans = Math.max(ans, solveDP(arr));
            out.println(ans);
        }

        // while (true) {
        // int n = (int) Math.round(Math.random() * 10);
        // long[] randArr = generateRandom(Math.max(n, 2));
        // long bruteSol = solveBrute(randArr), dpSol = solveDP(randArr);
        // if (bruteSol != dpSol) {
        // System.out.println(Arrays.toString(randArr));
        // System.out.println(bruteSol);
        // System.out.println(dpSol);
        // return;
        // }
        // }
        out.close();
        br.close();
    }

    public static long solveDP(long[] input) {
        long[] arr = new long[input.length - 1];
        for (int i = 0; i < input.length - 1; i++)
            arr[i] = Math.abs(input[i] - input[i + 1]) * (i % 2 == 0 ? 1 : -1);
        long curr = arr[0];
        long ans = arr[0];
        for (int i = 1; i < arr.length; i++) {
            curr = Math.max(curr + arr[i], arr[i]);
            ans = Math.max(ans, curr);
        }
        return ans;
    }

    public static long[] generateRandom(int n) {
        long[] ret = new long[n];
        for (int i = 0; i < n; i++) {
            ret[i] = (long) (Math.random() * 1000000000);
            if (Math.round(Math.random()) != 0)
                ret[i] *= -1;
        }
        return ret;
    }

    public static long solveBrute(long[] input) {
        long ans = Long.MIN_VALUE;
        for (int i = 0; i < input.length; i++) {
            long curr = 0;
            for (int j = i + 1; j < input.length; j++) {
                curr += Math.abs(input[j] - input[j - 1]) * ((j - 1) % 2 == 0 ? 1 : -1);
                ans = Math.max(ans, curr);
            }
        }
        return ans;
    }
}


import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Div2_407_C {
    public static void main(String[] args) throws IOException {
        BufferedInputStream bis = new BufferedInputStream(System.in);
        // bis = new BufferedInputStream(new FileInputStream("C.in"));
        BufferedReader br = new BufferedReader(new InputStreamReader(bis));
        PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));
        // out = new PrintWriter(new File("C.out"));
        String input;

        while ((input = br.readLine()) != null && !input.equals("")) {
            int n = Integer.parseInt(input.trim());
            long[] arr = new long[n];
            StringTokenizer st = new StringTokenizer(br.readLine());
            for (int i = 0; i < n; i++) {
                arr[i] = Integer.parseInt(st.nextToken());
            }
            out.println(solveDP(arr));
        }

        // while (true) {
        // int n = (int) Math.round(Math.random() * 10);
        // long[] randArr = generateRandom(Math.max(n, 2));
        // long bruteSol = solveBrute(randArr), dpSol = solveDP(randArr);
        // if (bruteSol != dpSol) {
        // System.out.println(Arrays.toString(randArr));
        // System.out.println(bruteSol);
        // System.out.println(dpSol);
        // return;
        // }
        // }
        out.close();
        br.close();
    }

    public static long solveDP(long[] input) {
        long[] arr = new long[input.length - 1];
        for (int i = 0; i < input.length - 1; i++)
            arr[i] = Math.abs(input[i] - input[i + 1]) * (i % 2 == 0 ? 1 : -1);
        long curr = arr[0];
        long ans = arr[0];
        for (int i = 1; i < arr.length; i++) {
            curr = Math.max(curr + arr[i], arr[i]);
            ans = Math.max(ans, curr);
        }
        return ans;
    }

    public static long[] generateRandom(int n) {
        long[] ret = new long[n];
        for (int i = 0; i < n; i++) {
            ret[i] = (long) (Math.random() * 1000000000);
            if (Math.round(Math.random()) != 0)
                ret[i] *= -1;
        }
        return ret;
    }

    public static long solveBrute(long[] input) {
        long ans = Long.MIN_VALUE;
        for (int i = 0; i < input.length; i++) {
            long curr = 0;
            for (int j = i + 1; j < input.length; j++) {
                curr += Math.abs(input[j] - input[j - 1]) * ((j - 1) % 2 == 0 ? 1 : -1);
                ans = Math.max(ans, curr);
            }
        }
        return ans;
    }
}


import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class main
{
	private static InputStream stream;
	private static byte[] buf = new byte[1024];
	private static int curChar;
	private static int numChars;
	private static SpaceCharFilter filter;
	private static PrintWriter pw;
	private static long mod = 1000000000 + 7;
	private static void soln()
	{
		/*long b1= nextLong();
		long q=nextLong();
		long l =nextLong();
		int m =nextInt();
		HashSet<Long> set = new HashSet<>();
		for(int i=0;i<m;i++)
			set.add(nextLong());
		//int[] arr = nextIntArray(m);
		long b=Math.abs(b1);
		if(q==1) {
			if(set.contains(b1) || b>l)
				pw.println(0);
			else
				pw.println("inf");
		}
		else if(q==-1) {
			if(b<=l) {
				if(!set.contains(b1) || !set.contains(-b1))
					pw.println("inf");
				else
					pw.println(0);
			}else
				pw.println(0);
		} else if(b1==0) {
			if(set.contains(0))
				pw.println(0);
			else
				pw.println("inf");
		}else if(q==0) {
			if(b<=l) {
				if(set.contains(0))
					if(set.contains(b1))
						pw.println(0);
					else
						pw.println(1);
				else
					pw.println("inf");
			}
			else
				pw.println("0");
		}
		else {
			int cnt=0;
			while(Math.abs(b1)<=l) {
				if(!set.contains(b1))
					cnt++;
				b1*=q;
			}
			pw.println(cnt);
		}*/
		int n = nextInt();
		int[] arr = nextIntArray(n);
		long[] diff = new long[n-1];
		for(int i=0;i<n-1;i++)
			diff[i]=Math.abs(arr[i]-arr[i+1]);
		TreeSet<Long> set = new TreeSet<>();
		set.add(0L);
		long totdiff=0;
		long ans = 0;
		for(int i=0;i<n-1;i++) {
			if(i%2==0)
				totdiff+=diff[i];
			else
				totdiff-=diff[i];
			totdiff = Math.max(totdiff - set.first(), set.last() - totdiff);
			ans = Math.max(totdiff, ans);
			set.add(totdiff);
		}
		pw.println(ans);
	}
	public static class Segment {
		private int[] tree;
		private boolean[] lazy;
		private int size;
		private int n;
		private class node{
			private int a;
			private int b;
			private int c;
			public node(int x,int y,int z){
				a=x;
				b=y;
				c=z;
			}
		}
		public Segment(int n){
			//this.base=arr;
			int x = (int) (Math.ceil(Math.log(n) / Math.log(2)));
	        size = 2 * (int) Math.pow(2, x) - 1;
			tree=new int[size];
			lazy=new boolean[size];
			this.n=n;
			build(0,0,n-1);
		}
		public void build(int id,int l,int r) {
			if(l==r) {
				return;
			}
			int mid=(l+r)/2;
			build(2*id+1,l,mid);
			build(2*id+2,mid+1,r);
			tree[id]=tree[2*id+1]+tree[2*id+2];
		}
		public int query(int l,int r){
			return queryUtil(l,r,0,0,n-1);
		}
		private int queryUtil(int x,int y,int id,int l,int r){
			if(l>y || x>r)
				return 0;
			if(x <= l && r<=y) {
				//if(!lazy[id])
					return tree[id];
				//else
				//	return tree[id][0];
			}
			int mid=l+(r-l)/2;
			shift(id);
			return queryUtil(x,y,2*id+1,l,mid)+queryUtil(x,y,2*id+2,mid+1,r);
		}
		public void update(int x,int y,int colour,int id,int l,int r){
			//System.out.println(l+" "+r+" "+x);
			if(x>r || y<l)
				return;
			if(x <= l && r<=y) {

				return;
			}
			int mid=l+(r-l)/2;
			shift(id);
			update(x,y,colour,2*id+1,l,mid);
			update(x,y,colour,2*id+2,mid+1,r);
			tree[id]=tree[2*id+1]+tree[2*id+2];
		}
		public void shift(int id) {

		}
	}

	public static void fft(double[] a, double[] b, boolean invert) {
		int count = a.length;
		for (int i = 1, j = 0; i < count; i++) {
			int bit = count >> 1;
			for (; j >= bit; bit >>= 1) j -= bit;
			j += bit;
			if (i < j) {
				double temp = a[i];
				a[i] = a[j];
				a[j] = temp;
				temp = b[i];
				b[i] = b[j];
				b[j] = temp;
			}
		}
		for (int len = 2; len <= count; len <<= 1) {
			int halfLen = len >> 1;
			double angle = 2 * Math.PI / len;
			if (invert) angle = -angle;
			double wLenA = Math.cos(angle), wLenB = Math.sin(angle);
			for (int i = 0; i < count; i += len) {
				double wA = 1, wB = 0;
				for (int j = 0; j < halfLen; j++) {
					double uA = a[i + j], uB = b[i + j];
					double vA = a[i + j + halfLen] * wA - b[i + j + halfLen] * wB;
					double vB = a[i + j + halfLen] * wB + b[i + j + halfLen] * wA;
					a[i + j] = uA + vA;
					b[i + j] = uB + vB;
					a[i + j + halfLen] = uA - vA;
					b[i + j + halfLen] = uB - vB;
					double nextWA = wA * wLenA - wB * wLenB;
					wB = wA * wLenB + wB * wLenA;
					wA = nextWA;
				}
			}
		}
		if (invert) {
			for (int i = 0; i < count; i++) {
				a[i] /= count;
				b[i] /= count;
			}
		}
	}
	static void multiply(long[][] a, long[][] b, long m)
	{
		int n = a.length;
		long[][] mul = new long[n][n];
		for (int i = 0; i < n; i++)
		{
			for (int j = 0; j < n; j++)
			{
				mul[i][j] = 0;
				for (int k = 0; k < n; k++)
					mul[i][j] = (mul[i][j] + (a[i][k] * b[k][j]) % m) % m;
			}
		}
		for (int i = 0; i < n; i++)
			for (int j = 0; j < n; j++)
				a[i][j] = mul[i][j];
	}

	private static long pow(long a, long b, long c)
	{
		if (b == 0)
			return 1;
		long p = pow(a, b / 2, c);
		p = (p * p) % c;
		return (b % 2 == 0) ? p : (a * p) % c;
	}

	private static long gcd(long n, long l)
	{
		if (l == 0)
			return n;
		return gcd(l, n % l);
	}
	public static void main(String[] args) throws Exception
	{
//		new Thread(null, new Runnable()
//		{
//			@Override
//			public void run()
//			{
//				/*try {
//					InputReader(new FileInputStream("C:\\Users\\hardik\\Desktop\\B-large-practice.in"));
//				} catch (FileNotFoundException e) { // TODO Auto-generated catch block
//					e.printStackTrace();
//				} */
//				InputReader(System.in);
//				pw = new PrintWriter(System.out);
//				/*try {
//					pw=new PrintWriter(new FileOutputStream("C:\\Users\\hardik\\Desktop\\out.txt"));
//				} catch (FileNotFoundException e) { // TODO Auto-generated catch block
//					e.printStackTrace();
//				}*/
//				soln();
//				pw.close();
//			}
//		}, "1", 1 << 26).start();

		/*try {
			InputReader(new FileInputStream("C:\\Users\\hardik\\Desktop\\B-large-practice.in"));
		} catch (FileNotFoundException e) { // TODO Auto-generated catch block
			e.printStackTrace();
		} */
		InputReader(System.in);
		pw = new PrintWriter(System.out);
		/*try {
			pw=new PrintWriter(new FileOutputStream("C:\\Users\\hardik\\Desktop\\out.txt"));
		} catch (FileNotFoundException e) { // TODO Auto-generated catch block
			e.printStackTrace();
		}*/
		soln();
		pw.close();
	}

	public static void InputReader(InputStream stream1)
	{
		stream = stream1;
	}

	private static boolean isWhitespace(int c)
	{
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	private static boolean isEndOfLine(int c)
	{
		return c == '\n' || c == '\r' || c == -1;
	}

	private static int read()
	{
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars)
		{
			curChar = 0;
			try
			{
				numChars = stream.read(buf);
			} catch (IOException e)
			{
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

	private static int nextInt()
	{
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-')
		{
			sgn = -1;
			c = read();
		}
		int res = 0;
		do
		{
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	private static long nextLong()
	{
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-')
		{
			sgn = -1;
			c = read();
		}
		long res = 0;
		do
		{
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	private static String nextToken()
	{
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do
		{
			res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}

	private static String nextLine()
	{
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do
		{
			res.appendCodePoint(c);
			c = read();
		} while (!isEndOfLine(c));
		return res.toString();
	}

	private static int[] nextIntArray(int n)
	{
		int[] arr = new int[n];
		for (int i = 0; i < n; i++)
		{
			arr[i] = nextInt();
		}
		return arr;
	}

	private static long[] nextLongArray(int n)
	{
		long[] arr = new long[n];
		for (int i = 0; i < n; i++)
		{
			arr[i] = nextLong();
		}
		return arr;
	}

	private static void pArray(int[] arr)
	{
		for (int i = 0; i < arr.length; i++)
		{
			System.out.print(arr[i] + " ");
		}
		System.out.println();
		return;
	}

	private static void pArray(long[] arr)
	{
		for (int i = 0; i < arr.length; i++)
		{
			System.out.print(arr[i] + " ");
		}
		System.out.println();
		return;
	}

	private static boolean isSpaceChar(int c)
	{
		if (filter != null)
			return filter.isSpaceChar(c);
		return isWhitespace(c);
	}

	private static char nextChar()
	{
		int c = read();
		while (isSpaceChar(c))
			c = read();
		char c1 = (char) c;
		while (!isSpaceChar(c))
			c = read();
		return c1;
	}

	private interface SpaceCharFilter
	{
		public boolean isSpaceChar(int ch);
	}
}


import java.io.*;
import java.math.BigInteger;
import java.util.*;

public class main
{
	private static InputStream stream;
	private static byte[] buf = new byte[1024];
	private static int curChar;
	private static int numChars;
	private static SpaceCharFilter filter;
	private static PrintWriter pw;
	private static long mod = 1000000000 + 7;
	private static void soln()
	{
		/*long b1= nextLong();
		long q=nextLong();
		long l =nextLong();
		int m =nextInt();
		HashSet<Long> set = new HashSet<>();
		for(int i=0;i<m;i++)
			set.add(nextLong());
		//int[] arr = nextIntArray(m);
		long b=Math.abs(b1);
		if(q==1) {
			if(set.contains(b1) || b>l)
				pw.println(0);
			else
				pw.println("inf");
		}
		else if(q==-1) {
			if(b<=l) {
				if(!set.contains(b1) || !set.contains(-b1))
					pw.println("inf");
				else
					pw.println(0);
			}else
				pw.println(0);
		} else if(b1==0) {
			if(set.contains(0))
				pw.println(0);
			else
				pw.println("inf");
		}else if(q==0) {
			if(b<=l) {
				if(set.contains(0))
					if(set.contains(b1))
						pw.println(0);
					else
						pw.println(1);
				else
					pw.println("inf");
			}
			else
				pw.println("0");
		}
		else {
			int cnt=0;
			while(Math.abs(b1)<=l) {
				if(!set.contains(b1))
					cnt++;
				b1*=q;
			}
			pw.println(cnt);
		}*/
		int n = nextInt();
		int[] arr = nextIntArray(n);
		long[] diff = new long[n-1];
		for(int i=0;i<n-1;i++)
			diff[i]=Math.abs(arr[i]-arr[i+1]);
		TreeSet<Long> set = new TreeSet<>();
		set.add(0L);
		long totdiff=0;
		long ans = 0;
		for(int i=0;i<n-1;i++) {
			long totdiff1 = 0;
			if(i%2==0) {
				totdiff+=diff[i];
				totdiff1 = totdiff - set.first();
			}
			else {
				totdiff-=diff[i];
				totdiff1 = set.last() - totdiff;
			}
			//totdiff = Math.max(totdiff - set.first(), set.last() - totdiff);
			ans = Math.max(totdiff1, ans);
			set.add(totdiff);
		}
		pw.println(ans);
	}
	public static class Segment {
		private int[] tree;
		private boolean[] lazy;
		private int size;
		private int n;
		private class node{
			private int a;
			private int b;
			private int c;
			public node(int x,int y,int z){
				a=x;
				b=y;
				c=z;
			}
		}
		public Segment(int n){
			//this.base=arr;
			int x = (int) (Math.ceil(Math.log(n) / Math.log(2)));
	        size = 2 * (int) Math.pow(2, x) - 1;
			tree=new int[size];
			lazy=new boolean[size];
			this.n=n;
			build(0,0,n-1);
		}
		public void build(int id,int l,int r) {
			if(l==r) {
				return;
			}
			int mid=(l+r)/2;
			build(2*id+1,l,mid);
			build(2*id+2,mid+1,r);
			tree[id]=tree[2*id+1]+tree[2*id+2];
		}
		public int query(int l,int r){
			return queryUtil(l,r,0,0,n-1);
		}
		private int queryUtil(int x,int y,int id,int l,int r){
			if(l>y || x>r)
				return 0;
			if(x <= l && r<=y) {
				//if(!lazy[id])
					return tree[id];
				//else
				//	return tree[id][0];
			}
			int mid=l+(r-l)/2;
			shift(id);
			return queryUtil(x,y,2*id+1,l,mid)+queryUtil(x,y,2*id+2,mid+1,r);
		}
		public void update(int x,int y,int colour,int id,int l,int r){
			//System.out.println(l+" "+r+" "+x);
			if(x>r || y<l)
				return;
			if(x <= l && r<=y) {

				return;
			}
			int mid=l+(r-l)/2;
			shift(id);
			update(x,y,colour,2*id+1,l,mid);
			update(x,y,colour,2*id+2,mid+1,r);
			tree[id]=tree[2*id+1]+tree[2*id+2];
		}
		public void shift(int id) {

		}
	}

	public static void fft(double[] a, double[] b, boolean invert) {
		int count = a.length;
		for (int i = 1, j = 0; i < count; i++) {
			int bit = count >> 1;
			for (; j >= bit; bit >>= 1) j -= bit;
			j += bit;
			if (i < j) {
				double temp = a[i];
				a[i] = a[j];
				a[j] = temp;
				temp = b[i];
				b[i] = b[j];
				b[j] = temp;
			}
		}
		for (int len = 2; len <= count; len <<= 1) {
			int halfLen = len >> 1;
			double angle = 2 * Math.PI / len;
			if (invert) angle = -angle;
			double wLenA = Math.cos(angle), wLenB = Math.sin(angle);
			for (int i = 0; i < count; i += len) {
				double wA = 1, wB = 0;
				for (int j = 0; j < halfLen; j++) {
					double uA = a[i + j], uB = b[i + j];
					double vA = a[i + j + halfLen] * wA - b[i + j + halfLen] * wB;
					double vB = a[i + j + halfLen] * wB + b[i + j + halfLen] * wA;
					a[i + j] = uA + vA;
					b[i + j] = uB + vB;
					a[i + j + halfLen] = uA - vA;
					b[i + j + halfLen] = uB - vB;
					double nextWA = wA * wLenA - wB * wLenB;
					wB = wA * wLenB + wB * wLenA;
					wA = nextWA;
				}
			}
		}
		if (invert) {
			for (int i = 0; i < count; i++) {
				a[i] /= count;
				b[i] /= count;
			}
		}
	}
	static void multiply(long[][] a, long[][] b, long m)
	{
		int n = a.length;
		long[][] mul = new long[n][n];
		for (int i = 0; i < n; i++)
		{
			for (int j = 0; j < n; j++)
			{
				mul[i][j] = 0;
				for (int k = 0; k < n; k++)
					mul[i][j] = (mul[i][j] + (a[i][k] * b[k][j]) % m) % m;
			}
		}
		for (int i = 0; i < n; i++)
			for (int j = 0; j < n; j++)
				a[i][j] = mul[i][j];
	}

	private static long pow(long a, long b, long c)
	{
		if (b == 0)
			return 1;
		long p = pow(a, b / 2, c);
		p = (p * p) % c;
		return (b % 2 == 0) ? p : (a * p) % c;
	}

	private static long gcd(long n, long l)
	{
		if (l == 0)
			return n;
		return gcd(l, n % l);
	}
	public static void main(String[] args) throws Exception
	{
//		new Thread(null, new Runnable()
//		{
//			@Override
//			public void run()
//			{
//				/*try {
//					InputReader(new FileInputStream("C:\\Users\\hardik\\Desktop\\B-large-practice.in"));
//				} catch (FileNotFoundException e) { // TODO Auto-generated catch block
//					e.printStackTrace();
//				} */
//				InputReader(System.in);
//				pw = new PrintWriter(System.out);
//				/*try {
//					pw=new PrintWriter(new FileOutputStream("C:\\Users\\hardik\\Desktop\\out.txt"));
//				} catch (FileNotFoundException e) { // TODO Auto-generated catch block
//					e.printStackTrace();
//				}*/
//				soln();
//				pw.close();
//			}
//		}, "1", 1 << 26).start();

		/*try {
			InputReader(new FileInputStream("C:\\Users\\hardik\\Desktop\\B-large-practice.in"));
		} catch (FileNotFoundException e) { // TODO Auto-generated catch block
			e.printStackTrace();
		} */
		InputReader(System.in);
		pw = new PrintWriter(System.out);
		/*try {
			pw=new PrintWriter(new FileOutputStream("C:\\Users\\hardik\\Desktop\\out.txt"));
		} catch (FileNotFoundException e) { // TODO Auto-generated catch block
			e.printStackTrace();
		}*/
		soln();
		pw.close();
	}

	public static void InputReader(InputStream stream1)
	{
		stream = stream1;
	}

	private static boolean isWhitespace(int c)
	{
		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
	}

	private static boolean isEndOfLine(int c)
	{
		return c == '\n' || c == '\r' || c == -1;
	}

	private static int read()
	{
		if (numChars == -1)
			throw new InputMismatchException();
		if (curChar >= numChars)
		{
			curChar = 0;
			try
			{
				numChars = stream.read(buf);
			} catch (IOException e)
			{
				throw new InputMismatchException();
			}
			if (numChars <= 0)
				return -1;
		}
		return buf[curChar++];
	}

	private static int nextInt()
	{
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-')
		{
			sgn = -1;
			c = read();
		}
		int res = 0;
		do
		{
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	private static long nextLong()
	{
		int c = read();
		while (isSpaceChar(c))
			c = read();
		int sgn = 1;
		if (c == '-')
		{
			sgn = -1;
			c = read();
		}
		long res = 0;
		do
		{
			if (c < '0' || c > '9')
				throw new InputMismatchException();
			res *= 10;
			res += c - '0';
			c = read();
		} while (!isSpaceChar(c));
		return res * sgn;
	}

	private static String nextToken()
	{
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do
		{
			res.appendCodePoint(c);
			c = read();
		} while (!isSpaceChar(c));
		return res.toString();
	}

	private static String nextLine()
	{
		int c = read();
		while (isSpaceChar(c))
			c = read();
		StringBuilder res = new StringBuilder();
		do
		{
			res.appendCodePoint(c);
			c = read();
		} while (!isEndOfLine(c));
		return res.toString();
	}

	private static int[] nextIntArray(int n)
	{
		int[] arr = new int[n];
		for (int i = 0; i < n; i++)
		{
			arr[i] = nextInt();
		}
		return arr;
	}

	private static long[] nextLongArray(int n)
	{
		long[] arr = new long[n];
		for (int i = 0; i < n; i++)
		{
			arr[i] = nextLong();
		}
		return arr;
	}

	private static void pArray(int[] arr)
	{
		for (int i = 0; i < arr.length; i++)
		{
			System.out.print(arr[i] + " ");
		}
		System.out.println();
		return;
	}

	private static void pArray(long[] arr)
	{
		for (int i = 0; i < arr.length; i++)
		{
			System.out.print(arr[i] + " ");
		}
		System.out.println();
		return;
	}

	private static boolean isSpaceChar(int c)
	{
		if (filter != null)
			return filter.isSpaceChar(c);
		return isWhitespace(c);
	}

	private static char nextChar()
	{
		int c = read();
		while (isSpaceChar(c))
			c = read();
		char c1 = (char) c;
		while (!isSpaceChar(c))
			c = read();
		return c1;
	}

	private interface SpaceCharFilter
	{
		public boolean isSpaceChar(int ch);
	}
}