import java.io.*;
import java.math.*;
import java.util.*;
import javax.print.attribute.SetOfIntegerSyntax;

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 count = 0,mod=1000000007;
	private static TreeSet<Integer>ts[]=new TreeSet[200000];

	public static void main(String args[]) throws Exception {
		InputReader(System.in);
		pw = new PrintWriter(System.out);
        new Thread(null ,new Runnable(){
           public void run(){
               try{
                   soln();
                   pw.close();
               } catch(Exception e){
                   e.printStackTrace();
               }
           }
       },"1",1<<26).start();
	}
	//----------------------------------------My Code------------------------------------------------//
	public static class Participant implements Comparable<Participant>{
		String name;
		int score;
		Participant(String s, int n){
			this.name=s;
			this.score=n;
		}
		@Override
		public int compareTo(Participant o){
			if(o.score<score){
				return 1;
			}
			else if(o.name.equals(this.name)) return 0;
			else{
				return -1;
			}
		}
		@Override
		public boolean equals(Object obj){
			if(obj==null) return false;
			if(obj.getClass()!=this.getClass()) return false;
			Participant prt=(Participant) obj;
			if(this.name.equals(prt.name)) return true;
			return false;
		}
		@Override
		public int hashCode(){
			return this.name.hashCode();
		}
	}
	public static class Comp<T> implements Comparator<Participant>{
		@Override
		public int compare(Participant p1, Participant p2) {
			if(p1.score<p2.score) return 1;
			else
			return 0;
		}
	}
	private static void soln() {
		int n=nextInt();
		int[] arr=nextIntArray(n);
		long[] dp=new long[n-1];
		int current=1;
		dp[0]=Math.abs(arr[0]-arr[1])*current;
		current=-1;
		for(int i=1;i<(n-1);i++){
			dp[i]=dp[i-1]+(Math.abs(arr[i]-arr[i+1])*current);
			current*=-1;
		}
		Arrays.sort(dp);
		pw.println(Math.max(dp[n-2],dp[n-2]-dp[0]));
	}

	public static int fact(int n){
		int ans=1;
		for(int i=1;i<=n;i++) ans=(ans*i)%1000000007;
		return ans;
	}
	//----------------------------------------THE END----------------------------------------------------------//

	static class Pair implements Comparable<Pair>{

		int k,l;
		Pair(int k,int l){

			this.k=k;
			this.l=l;
		}
		@Override
		public int compareTo(Pair o) {
			// TODO Auto-generated method stub
		//	Sort in increasing order

			return Integer.compare(k,o.k);
			/*if(Math.min(2*o.k, o.l)<Math.min(2*k, l)){
				return -1;
			}
			else if(Math.min(2*o.k, o.l)==Math.min(2*k, l)){
				return 0;
			}else{
				return 1;
			}*/

		}

	}

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

	private static int BinarySearch(int a[], int low, int high, int target) {
		if (low > high)
			return -1;
		int mid = low + (high - low) / 2;
		if (a[mid] == target)
			return mid;
		if (a[mid] > target)
			high = mid - 1;
		if (a[mid] < target)
			low = mid + 1;
		return BinarySearch(a, low, high, target);
	}

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

	public static long pow(long n, long p, long m) {
		long result = 1;
		if (p == 0)
			return 1;
		if (p == 1)
			return n;
		while (p != 0) {
			if (p % 2 == 1)
				result *= n;
			if (result >= m)
				result %= m;
			p >>= 1;
			n *= n;
			if (n >= m)
				n %= m;
		}
		return result;
	}

	public static long pow(long n, long p) {
		long result = 1;
		if (p == 0)
			return 1;
		if (p == 1)
			return n;
		while (p != 0) {
			if (p % 2 == 1)
				result *= n;
			p >>= 1;
			n *= n;
		}
		return result;

	}

 	public static int[] radixSort(int[] f) {
		int[] to = new int[f.length];
		{
			int[] b = new int[65537];
			for (int i = 0; i < f.length; i++)
				b[1 + (f[i] & 0xffff)]++;
			for (int i = 1; i <= 65536; i++)
				b[i] += b[i - 1];
			for (int i = 0; i < f.length; i++)
				to[b[f[i] & 0xffff]++] = f[i];
			int[] d = f;
			f = to;
			to = d;
		}
		{
			int[] b = new int[65537];
			for (int i = 0; i < f.length; i++)
				b[1 + (f[i] >>> 16)]++;
			for (int i = 1; i <= 65536; i++)
				b[i] += b[i - 1];
			for (int i = 0; i < f.length; i++)
				to[b[f[i] >>> 16]++] = f[i];
			int[] d = f;
			f = to;
			to = d;
		}
		return f;
	}

	public static int nextPowerOf2(final int a) {
		int b = 1;
		while (b < a) {
			b = b << 1;
		}
		return b;
	}

	public static boolean PointInTriangle(int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8) {
		int s = p2 * p5 - p1 * p6 + (p6 - p2) * p7 + (p1 - p5) * p8;
		int t = p1 * p4 - p2 * p3 + (p2 - p4) * p7 + (p3 - p1) * p8;

		if ((s < 0) != (t < 0))
			return false;

		int A = -p4 * p5 + p2 * (p5 - p3) + p1 * (p4 - p6) + p3 * p6;
		if (A < 0.0) {
			s = -s;
			t = -t;
			A = -A;
		}
		return s > 0 && t > 0 && (s + t) <= A;
	}

	public static float area(int x1, int y1, int x2, int y2, int x3, int y3) {
		return (float) Math.abs((x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)) / 2.0);
	}

	public static boolean isPrime(int n) {
		// Corner cases
		if (n <= 1)
			return false;
		if (n <= 3)
			return true;

		// This is checked so that we can skip
		// middle five numbers in below loop
		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;
	}

	//merge Sort

	static long sort(int a[])
	{  int n=a.length;
		int b[]=new int[n];
		return mergeSort(a,b,0,n-1);}
	static long mergeSort(int a[],int b[],long left,long right)
	{ long c=0;if(left<right)
	 {   long mid=left+(right-left)/2;
		 c= mergeSort(a,b,left,mid);
		 c+=mergeSort(a,b,mid+1,right);
		 c+=merge(a,b,left,mid+1,right); }
		return c;	 }
	static long merge(int a[],int  b[],long left,long mid,long right)
	{long c=0;int i=(int)left;int j=(int)mid; int k=(int)left;
	while(i<=(int)mid-1&&j<=(int)right)
	{ if(a[i]>a[j]) {b[k++]=a[i++]; }
	else	{ b[k++]=a[j++];c+=mid-i;}}
	while (i <= (int)mid - 1)   b[k++] = a[i++];
	while (j <= (int)right) b[k++] = a[j++];
	for (i=(int)left; i <= (int)right; i++)
		a[i] = b[i];  return c;  }

	// To Get Input
	// Some Buffer Methods

	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 int[][] next2dArray(int n, int m) {
		int[][] arr = new int[n][m];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				arr[i][j] = 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++) {
			pw.print(arr[i] + " ");
		}
		pw.println();
		return;
	}

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

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

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

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

    }


import java.io.*;
import java.math.*;
import java.util.*;
import javax.print.attribute.SetOfIntegerSyntax;

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 count = 0,mod=1000000007;
	private static TreeSet<Integer>ts[]=new TreeSet[200000];

	public static void main(String args[]) throws Exception {
		InputReader(System.in);
		pw = new PrintWriter(System.out);
        new Thread(null ,new Runnable(){
           public void run(){
               try{
                   soln();
                   pw.close();
               } catch(Exception e){
                   e.printStackTrace();
               }
           }
       },"1",1<<26).start();
	}
	//----------------------------------------My Code------------------------------------------------//
	public static class Participant implements Comparable<Participant>{
		String name;
		int score;
		Participant(String s, int n){
			this.name=s;
			this.score=n;
		}
		@Override
		public int compareTo(Participant o){
			if(o.score<score){
				return 1;
			}
			else if(o.name.equals(this.name)) return 0;
			else{
				return -1;
			}
		}
		@Override
		public boolean equals(Object obj){
			if(obj==null) return false;
			if(obj.getClass()!=this.getClass()) return false;
			Participant prt=(Participant) obj;
			if(this.name.equals(prt.name)) return true;
			return false;
		}
		@Override
		public int hashCode(){
			return this.name.hashCode();
		}
	}
	public static class Comp<T> implements Comparator<Participant>{
		@Override
		public int compare(Participant p1, Participant p2) {
			if(p1.score<p2.score) return 1;
			else
			return 0;
		}
	}
	private static void soln() {
		int n=nextInt();
		int[] arr=nextIntArray(n);
		int[] dp=new int[n-1];
		int current=1;
		dp[0]=Math.abs(arr[0]-arr[1])*current;
		current=-1;
		for(int i=1;i<(n-1);i++){
			dp[i]=dp[i-1]+(Math.abs(arr[i]-arr[i+1])*current);
			current*=-1;
		}
		Arrays.sort(dp);
		pw.println(Math.max(dp[n-2],dp[n-2]-dp[0]));
	}

	public static int fact(int n){
		int ans=1;
		for(int i=1;i<=n;i++) ans=(ans*i)%1000000007;
		return ans;
	}
	//----------------------------------------THE END----------------------------------------------------------//

	static class Pair implements Comparable<Pair>{

		int k,l;
		Pair(int k,int l){

			this.k=k;
			this.l=l;
		}
		@Override
		public int compareTo(Pair o) {
			// TODO Auto-generated method stub
		//	Sort in increasing order

			return Integer.compare(k,o.k);
			/*if(Math.min(2*o.k, o.l)<Math.min(2*k, l)){
				return -1;
			}
			else if(Math.min(2*o.k, o.l)==Math.min(2*k, l)){
				return 0;
			}else{
				return 1;
			}*/

		}

	}

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

	private static int BinarySearch(int a[], int low, int high, int target) {
		if (low > high)
			return -1;
		int mid = low + (high - low) / 2;
		if (a[mid] == target)
			return mid;
		if (a[mid] > target)
			high = mid - 1;
		if (a[mid] < target)
			low = mid + 1;
		return BinarySearch(a, low, high, target);
	}

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

	public static long pow(long n, long p, long m) {
		long result = 1;
		if (p == 0)
			return 1;
		if (p == 1)
			return n;
		while (p != 0) {
			if (p % 2 == 1)
				result *= n;
			if (result >= m)
				result %= m;
			p >>= 1;
			n *= n;
			if (n >= m)
				n %= m;
		}
		return result;
	}

	public static long pow(long n, long p) {
		long result = 1;
		if (p == 0)
			return 1;
		if (p == 1)
			return n;
		while (p != 0) {
			if (p % 2 == 1)
				result *= n;
			p >>= 1;
			n *= n;
		}
		return result;

	}

 	public static int[] radixSort(int[] f) {
		int[] to = new int[f.length];
		{
			int[] b = new int[65537];
			for (int i = 0; i < f.length; i++)
				b[1 + (f[i] & 0xffff)]++;
			for (int i = 1; i <= 65536; i++)
				b[i] += b[i - 1];
			for (int i = 0; i < f.length; i++)
				to[b[f[i] & 0xffff]++] = f[i];
			int[] d = f;
			f = to;
			to = d;
		}
		{
			int[] b = new int[65537];
			for (int i = 0; i < f.length; i++)
				b[1 + (f[i] >>> 16)]++;
			for (int i = 1; i <= 65536; i++)
				b[i] += b[i - 1];
			for (int i = 0; i < f.length; i++)
				to[b[f[i] >>> 16]++] = f[i];
			int[] d = f;
			f = to;
			to = d;
		}
		return f;
	}

	public static int nextPowerOf2(final int a) {
		int b = 1;
		while (b < a) {
			b = b << 1;
		}
		return b;
	}

	public static boolean PointInTriangle(int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8) {
		int s = p2 * p5 - p1 * p6 + (p6 - p2) * p7 + (p1 - p5) * p8;
		int t = p1 * p4 - p2 * p3 + (p2 - p4) * p7 + (p3 - p1) * p8;

		if ((s < 0) != (t < 0))
			return false;

		int A = -p4 * p5 + p2 * (p5 - p3) + p1 * (p4 - p6) + p3 * p6;
		if (A < 0.0) {
			s = -s;
			t = -t;
			A = -A;
		}
		return s > 0 && t > 0 && (s + t) <= A;
	}

	public static float area(int x1, int y1, int x2, int y2, int x3, int y3) {
		return (float) Math.abs((x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)) / 2.0);
	}

	public static boolean isPrime(int n) {
		// Corner cases
		if (n <= 1)
			return false;
		if (n <= 3)
			return true;

		// This is checked so that we can skip
		// middle five numbers in below loop
		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;
	}

	//merge Sort

	static long sort(int a[])
	{  int n=a.length;
		int b[]=new int[n];
		return mergeSort(a,b,0,n-1);}
	static long mergeSort(int a[],int b[],long left,long right)
	{ long c=0;if(left<right)
	 {   long mid=left+(right-left)/2;
		 c= mergeSort(a,b,left,mid);
		 c+=mergeSort(a,b,mid+1,right);
		 c+=merge(a,b,left,mid+1,right); }
		return c;	 }
	static long merge(int a[],int  b[],long left,long mid,long right)
	{long c=0;int i=(int)left;int j=(int)mid; int k=(int)left;
	while(i<=(int)mid-1&&j<=(int)right)
	{ if(a[i]>a[j]) {b[k++]=a[i++]; }
	else	{ b[k++]=a[j++];c+=mid-i;}}
	while (i <= (int)mid - 1)   b[k++] = a[i++];
	while (j <= (int)right) b[k++] = a[j++];
	for (i=(int)left; i <= (int)right; i++)
		a[i] = b[i];  return c;  }

	// To Get Input
	// Some Buffer Methods

	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 int[][] next2dArray(int n, int m) {
		int[][] arr = new int[n][m];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				arr[i][j] = 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++) {
			pw.print(arr[i] + " ");
		}
		pw.println();
		return;
	}

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

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

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

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

    }


import java.io.*;
import java.math.*;
import java.util.*;
import javax.print.attribute.SetOfIntegerSyntax;

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 count = 0,mod=1000000007;
	private static TreeSet<Integer>ts[]=new TreeSet[200000];

	public static void main(String args[]) throws Exception {
		InputReader(System.in);
		pw = new PrintWriter(System.out);
        new Thread(null ,new Runnable(){
           public void run(){
               try{
                   soln();
                   pw.close();
               } catch(Exception e){
                   e.printStackTrace();
               }
           }
       },"1",1<<26).start();
	}
	//----------------------------------------My Code------------------------------------------------//
	public static class Participant implements Comparable<Participant>{
		String name;
		int score;
		Participant(String s, int n){
			this.name=s;
			this.score=n;
		}
		@Override
		public int compareTo(Participant o){
			if(o.score<score){
				return 1;
			}
			else if(o.name.equals(this.name)) return 0;
			else{
				return -1;
			}
		}
		@Override
		public boolean equals(Object obj){
			if(obj==null) return false;
			if(obj.getClass()!=this.getClass()) return false;
			Participant prt=(Participant) obj;
			if(this.name.equals(prt.name)) return true;
			return false;
		}
		@Override
		public int hashCode(){
			return this.name.hashCode();
		}
	}
	public static class Comp<T> implements Comparator<Participant>{
		@Override
		public int compare(Participant p1, Participant p2) {
			if(p1.score<p2.score) return 1;
			else
			return 0;
		}
	}
	private static void soln() {
		int n=nextInt();
		int[] arr=nextIntArray(n);
		int[] dp=new int[n-1];
		int current=1;
		dp[0]=Math.abs(arr[0]-arr[1])*current;
		current=-1;
		for(int i=1;i<(n-1);i++){
			dp[i]=dp[i-1]+(Math.abs(arr[i]-arr[i+1])*current);
			current*=-1;
		}
		Arrays.sort(dp);
		if(dp[0]<0){
			pw.println(dp[n-1]-dp[0]);
		}
		else{
			pw.println(dp[n-2]);
		}
	}

	public static int fact(int n){
		int ans=1;
		for(int i=1;i<=n;i++) ans=(ans*i)%1000000007;
		return ans;
	}
	//----------------------------------------THE END----------------------------------------------------------//

	static class Pair implements Comparable<Pair>{

		int k,l;
		Pair(int k,int l){

			this.k=k;
			this.l=l;
		}
		@Override
		public int compareTo(Pair o) {
			// TODO Auto-generated method stub
		//	Sort in increasing order

			return Integer.compare(k,o.k);
			/*if(Math.min(2*o.k, o.l)<Math.min(2*k, l)){
				return -1;
			}
			else if(Math.min(2*o.k, o.l)==Math.min(2*k, l)){
				return 0;
			}else{
				return 1;
			}*/

		}

	}

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

	private static int BinarySearch(int a[], int low, int high, int target) {
		if (low > high)
			return -1;
		int mid = low + (high - low) / 2;
		if (a[mid] == target)
			return mid;
		if (a[mid] > target)
			high = mid - 1;
		if (a[mid] < target)
			low = mid + 1;
		return BinarySearch(a, low, high, target);
	}

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

	public static long pow(long n, long p, long m) {
		long result = 1;
		if (p == 0)
			return 1;
		if (p == 1)
			return n;
		while (p != 0) {
			if (p % 2 == 1)
				result *= n;
			if (result >= m)
				result %= m;
			p >>= 1;
			n *= n;
			if (n >= m)
				n %= m;
		}
		return result;
	}

	public static long pow(long n, long p) {
		long result = 1;
		if (p == 0)
			return 1;
		if (p == 1)
			return n;
		while (p != 0) {
			if (p % 2 == 1)
				result *= n;
			p >>= 1;
			n *= n;
		}
		return result;

	}

 	public static int[] radixSort(int[] f) {
		int[] to = new int[f.length];
		{
			int[] b = new int[65537];
			for (int i = 0; i < f.length; i++)
				b[1 + (f[i] & 0xffff)]++;
			for (int i = 1; i <= 65536; i++)
				b[i] += b[i - 1];
			for (int i = 0; i < f.length; i++)
				to[b[f[i] & 0xffff]++] = f[i];
			int[] d = f;
			f = to;
			to = d;
		}
		{
			int[] b = new int[65537];
			for (int i = 0; i < f.length; i++)
				b[1 + (f[i] >>> 16)]++;
			for (int i = 1; i <= 65536; i++)
				b[i] += b[i - 1];
			for (int i = 0; i < f.length; i++)
				to[b[f[i] >>> 16]++] = f[i];
			int[] d = f;
			f = to;
			to = d;
		}
		return f;
	}

	public static int nextPowerOf2(final int a) {
		int b = 1;
		while (b < a) {
			b = b << 1;
		}
		return b;
	}

	public static boolean PointInTriangle(int p1, int p2, int p3, int p4, int p5, int p6, int p7, int p8) {
		int s = p2 * p5 - p1 * p6 + (p6 - p2) * p7 + (p1 - p5) * p8;
		int t = p1 * p4 - p2 * p3 + (p2 - p4) * p7 + (p3 - p1) * p8;

		if ((s < 0) != (t < 0))
			return false;

		int A = -p4 * p5 + p2 * (p5 - p3) + p1 * (p4 - p6) + p3 * p6;
		if (A < 0.0) {
			s = -s;
			t = -t;
			A = -A;
		}
		return s > 0 && t > 0 && (s + t) <= A;
	}

	public static float area(int x1, int y1, int x2, int y2, int x3, int y3) {
		return (float) Math.abs((x1 * (y2 - y3) + x2 * (y3 - y1) + x3 * (y1 - y2)) / 2.0);
	}

	public static boolean isPrime(int n) {
		// Corner cases
		if (n <= 1)
			return false;
		if (n <= 3)
			return true;

		// This is checked so that we can skip
		// middle five numbers in below loop
		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;
	}

	//merge Sort

	static long sort(int a[])
	{  int n=a.length;
		int b[]=new int[n];
		return mergeSort(a,b,0,n-1);}
	static long mergeSort(int a[],int b[],long left,long right)
	{ long c=0;if(left<right)
	 {   long mid=left+(right-left)/2;
		 c= mergeSort(a,b,left,mid);
		 c+=mergeSort(a,b,mid+1,right);
		 c+=merge(a,b,left,mid+1,right); }
		return c;	 }
	static long merge(int a[],int  b[],long left,long mid,long right)
	{long c=0;int i=(int)left;int j=(int)mid; int k=(int)left;
	while(i<=(int)mid-1&&j<=(int)right)
	{ if(a[i]>a[j]) {b[k++]=a[i++]; }
	else	{ b[k++]=a[j++];c+=mid-i;}}
	while (i <= (int)mid - 1)   b[k++] = a[i++];
	while (j <= (int)right) b[k++] = a[j++];
	for (i=(int)left; i <= (int)right; i++)
		a[i] = b[i];  return c;  }

	// To Get Input
	// Some Buffer Methods

	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 int[][] next2dArray(int n, int m) {
		int[][] arr = new int[n][m];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				arr[i][j] = 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++) {
			pw.print(arr[i] + " ");
		}
		pw.println();
		return;
	}

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

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

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

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

    }


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

public class Hello {
	public static void main(String[] args) {
		FastReader s=new FastReader();
		PrintWriter pr=new PrintWriter(System.out,true);
		int n=s.nextInt();
		int a[]=new int[n+1];
		for(int i=1;i<=n;i++)
			a[i]=s.nextInt();

		int max=Integer.MIN_VALUE;

		boolean toggle;

		for(int i=1;i<=2;i++){
			int dp[]=new int[n+1];
			toggle=false;
			for(int j=i+1;j<=n;j++){
				if(i+1==j){
					dp[j]=Math.abs(a[j-1]-a[j]);
					toggle=true;
				}
				else{
					if(toggle){
						dp[j]=Math.abs(a[j-1]-a[j])*(-1);
						toggle=false;
					}
					else{
						dp[j]=Math.abs(a[j-1]-a[j]);
						toggle=true;
					}
				}
			}
					max=Math.max(max,fun(dp));
		}

		pr.println(max);

		pr.close();
	}

	public static int fun(int a[]){
		int n=a.length;
		int ans=Integer.MIN_VALUE,sum=0;

		for(int i=1;i<n;i++){
			//System.out.print(a[i]+" ");
			if(sum+a[i]>=0){
				sum+=a[i];
			}
			else{
				sum=0;
			}
			ans=Math.max(ans,sum);
		}
		//System.out.println();
		return ans;
	}

}

class FastReader
{
	BufferedReader br;
	StringTokenizer st;

	public FastReader()
	{
		br = new BufferedReader(new
			InputStreamReader(System.in));
	}

	String next()
	{
		while (st == null || !st.hasMoreElements())
		{
			try
			{
				st = new StringTokenizer(br.readLine());
			}
			catch (IOException  e)
			{
				e.printStackTrace();
			}
		}
		return st.nextToken();
	}

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

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

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

	String nextLine()
	{
		String str = "";
		try
		{
			str = br.readLine();
		}
		catch (IOException e)
		{
			e.printStackTrace();
		}
		return str;
	}
}


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

public class Hello {
	public static void main(String[] args) {
		FastReader s=new FastReader();
		PrintWriter pr=new PrintWriter(System.out,true);
		int n=s.nextInt();
		int a[]=new int[n+1];
		for(int i=1;i<=n;i++)
			a[i]=s.nextInt();

		long max=Long.MIN_VALUE;

		boolean toggle;

		for(int i=1;i<=2;i++){
			int dp[]=new int[n+1];
			toggle=false;
			for(int j=i+1;j<=n;j++){
				if(i+1==j){
					dp[j]=Math.abs(a[j-1]-a[j]);
					toggle=true;
				}
				else{
					if(toggle){
						dp[j]=Math.abs(a[j-1]-a[j])*(-1);
						toggle=false;
					}
					else{
						dp[j]=Math.abs(a[j-1]-a[j]);
						toggle=true;
					}
				}
			}
					max=Math.max(max,fun(dp));
		}

		pr.println(max);

		pr.close();
	}

	public static long fun(int a[]){
		int n=a.length;
		long ans=Long.MIN_VALUE;
		long sum=0;

		for(int i=1;i<n;i++){
			//System.out.print(a[i]+" ");
			if(sum+a[i]>=0){
				sum+=a[i];
			}
			else{
				sum=0;
			}
			ans=Math.max(ans,sum);
		}
		//System.out.println();
		return ans;
	}

}

class FastReader
{
	BufferedReader br;
	StringTokenizer st;

	public FastReader()
	{
		br = new BufferedReader(new
			InputStreamReader(System.in));
	}

	String next()
	{
		while (st == null || !st.hasMoreElements())
		{
			try
			{
				st = new StringTokenizer(br.readLine());
			}
			catch (IOException  e)
			{
				e.printStackTrace();
			}
		}
		return st.nextToken();
	}

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

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

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

	String nextLine()
	{
		String str = "";
		try
		{
			str = br.readLine();
		}
		catch (IOException e)
		{
			e.printStackTrace();
		}
		return str;
	}
}


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

public class Hello {
	public static void main(String[] args) {
		FastReader s=new FastReader();
		PrintWriter pr=new PrintWriter(System.out,true);
		int n=s.nextInt();
		int a[]=new int[n+1];
		for(int i=1;i<=n;i++)
			a[i]=s.nextInt();

		int dp[][]=new int[n+1][n+1];
		boolean toggle;
		for(int i=1;i<=n;i++){
			toggle=false;
			for(int j=i+1;j<=n;j++){
				if(i+1==j){
					//if((j&1)==0){
					dp[i][j]=Math.abs(a[j-1]-a[j]);
					toggle=true;
					//}
					//else
					//	dp[i][j]=Math.abs(a[j-1]-a[j])*-1;
				}
				else{
					//if((j&1)==1){
					if(toggle){
						dp[i][j]=dp[i][j-1]+Math.abs(a[j-1]-a[j])*(-1);
						toggle=false;
					}
					else{
						dp[i][j]=dp[i][j-1]+Math.abs(a[j-1]-a[j]);
						toggle=true;
					}
					// }
					// else{
					// 	dp[i][j]=dp[i][j-1]+Math.abs(a[j-1]-a[j]);
					// }
				}
			}
		}

		int max=Integer.MIN_VALUE;

		for(int i=1;i<=n;i++){
			for(int j=1;j<=n;j++){
				//pr.print(dp[i][j]+" ");
				max=Math.max(max,dp[i][j]);
			}
			//pr.println();
		}

		pr.println(max);

		pr.close();
	}

}

class FastReader
{
	BufferedReader br;
	StringTokenizer st;

	public FastReader()
	{
		br = new BufferedReader(new
			InputStreamReader(System.in));
	}

	String next()
	{
		while (st == null || !st.hasMoreElements())
		{
			try
			{
				st = new StringTokenizer(br.readLine());
			}
			catch (IOException  e)
			{
				e.printStackTrace();
			}
		}
		return st.nextToken();
	}

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

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

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

	String nextLine()
	{
		String str = "";
		try
		{
			str = br.readLine();
		}
		catch (IOException e)
		{
			e.printStackTrace();
		}
		return str;
	}
}


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

public class Hello {
	public static void main(String[] args) {
		FastReader s=new FastReader();
		PrintWriter pr=new PrintWriter(System.out,true);
		int n=s.nextInt();
		int a[]=new int[n+1];
		for(int i=1;i<=n;i++)
			a[i]=s.nextInt();

		int max=Integer.MIN_VALUE;

		boolean toggle;
		for(int i=1;i<=n;i++){
			int dp[]=new int[n+1];
			toggle=false;
			for(int j=i+1;j<=n;j++){
				if(i+1==j){
					dp[j]=Math.abs(a[j-1]-a[j]);
					toggle=true;
				}
				else{
					if(toggle){
						dp[j]=dp[j-1]+Math.abs(a[j-1]-a[j])*(-1);
						toggle=false;
					}
					else{
						dp[j]=dp[j-1]+Math.abs(a[j-1]-a[j]);
						toggle=true;
					}
				}
					max=Math.max(max,dp[j]);
			}
		}

		pr.println(max);

		pr.close();
	}

}

class FastReader
{
	BufferedReader br;
	StringTokenizer st;

	public FastReader()
	{
		br = new BufferedReader(new
			InputStreamReader(System.in));
	}

	String next()
	{
		while (st == null || !st.hasMoreElements())
		{
			try
			{
				st = new StringTokenizer(br.readLine());
			}
			catch (IOException  e)
			{
				e.printStackTrace();
			}
		}
		return st.nextToken();
	}

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

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

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

	String nextLine()
	{
		String str = "";
		try
		{
			str = br.readLine();
		}
		catch (IOException e)
		{
			e.printStackTrace();
		}
		return str;
	}
}


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

public class Div2_407C {

	public static void main(String[] args) throws IOException {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		int numI = Integer.parseInt(reader.readLine());
		int[] items = new int[numI + 1];
		StringTokenizer inputData = new StringTokenizer(reader.readLine());
		for (int i = 1; i <= numI; i++) {
			items[i] = Integer.parseInt(inputData.nextToken());
		}

		long[] pItems = new long[numI];
		for (int i = 1; i < numI; i++) {
			pItems[i] = ((i & 1) == 1 ? 1 : -1) * Math.abs(items[i] - items[i + 1]);
		}

		long ans = Long.MIN_VALUE;

		long prev = 0;
		for (int i = 1; i < numI; i++) {
			prev = prev > 0 ? prev + pItems[i] : pItems[i];
			if (prev > ans) {
				ans = prev;
			}
		}

		for (int i = 1; i < numI; i++) {
			pItems[i] = -pItems[i];
		}

		prev = 0;
		for (int i = 1; i < numI; i++) {
			prev = prev > 0 ? prev + pItems[i] : pItems[i];
			if (prev > ans) {
				ans = prev;
			}
		}
		System.out.println(ans);
	}

}


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

public class C {

	public static void main(String args[]) throws IOException
	{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int diff1[] = new int[n-1];
		int diff2[] = new int[n-1];
		int x = sc.nextInt();
		int a = -1;
		for (int i=0;i<n-1;i++)
		{
			int y = sc.nextInt();
			diff1[i] = Math.abs(x-y)*a;
			diff2[i] = diff1[i]*-1;
			x = y;
			a*=-1;
		}
		int max = 0;
		int soFar=0;
		for (int i=0;i<n-1;i++)
		{
			soFar+=diff1[i];
			if (soFar<0)
				soFar = 0;
			max = Math.max(max, soFar);
		}
		soFar = 0;
		for (int i=0;i<n-1;i++)
		{
			soFar+=diff2[i];
			if (soFar<0)
				soFar = 0;
			max = Math.max(max, soFar);
		}
		System.out.println(max);
	}
	static class Scanner
	{
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

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

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

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

		public String nextLine() throws IOException {return br.readLine();}

		public double nextDouble() throws IOException
		{
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if(x.charAt(0) == '-')
			{
				neg = true;
				start++;
			}
			for(int i = start; i < x.length(); i++)
				if(x.charAt(i) == '.')
				{
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				}
				else
				{
					sb.append(x.charAt(i));
					if(dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg?-1:1);
		}

		public boolean ready() throws IOException {return br.ready();}

	}
}


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

public class C {

	public static void main(String args[]) throws IOException
	{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int diff1[] = new int[n-1];
		int diff2[] = new int[n-1];
		int x = sc.nextInt();
		int a = -1;
		for (int i=0;i<n-1;i++)
		{
			int y = sc.nextInt();
			diff1[i] = Math.abs(x-y)*a;
			diff2[i] = diff1[i]*-1;
			x = y;
			a*=-1;
		}
		long max = 0;
		long soFar=0;
		for (int i=0;i<n-1;i++)
		{
			soFar+=diff1[i];
			if (soFar<0)
				soFar = 0;
			max = Math.max(max, soFar);
		}
		soFar = 0;
		for (int i=0;i<n-1;i++)
		{
			soFar+=diff2[i];
			if (soFar<0)
				soFar = 0;
			max = Math.max(max, soFar);
		}
		System.out.println(max);
	}
	static class Scanner
	{
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

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

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

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

		public String nextLine() throws IOException {return br.readLine();}

		public double nextDouble() throws IOException
		{
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if(x.charAt(0) == '-')
			{
				neg = true;
				start++;
			}
			for(int i = start; i < x.length(); i++)
				if(x.charAt(i) == '.')
				{
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				}
				else
				{
					sb.append(x.charAt(i));
					if(dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg?-1:1);
		}

		public boolean ready() throws IOException {return br.ready();}

	}
}


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

public class C789 {
	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(in.readLine());
		StringTokenizer tok = new StringTokenizer(in.readLine());
		int[] vals = new int[n];
		int[] diff = new int[n-1];
		int[] sums = new int[n-1];
		vals[0] = Integer.parseInt(tok.nextToken());
		int pSum = 0;
		int maxSum = Integer.MIN_VALUE;
		int maxI = 0;
		int minSum = Integer.MAX_VALUE;
		int minI = 0;
		for (int i = 1; i < n; i++) {
			vals[i] = Integer.parseInt(tok.nextToken());
			diff[i-1] = vals[i] - vals[i-1];
			if (diff[i-1] < 0) {
				diff[i-1] *= -1;
			}

			if (i%2==1) {
				pSum += diff[i-1];
			} else {
				pSum -= diff[i-1];
			}
			sums[i-1] = pSum;
			if (pSum > maxSum) {
				maxSum = pSum;
				maxI = i;
			}
			if (pSum < minSum) {
				minSum = pSum;
				minI = i;
			}
			System.out.println(pSum);
		}

		//System.out.println(maxI);
		if (minSum < 0) {
			System.out.println(maxSum-minSum);
		} else {
			System.out.println(maxSum);
		}
	}
}


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

public class C789 {
	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(in.readLine());
		StringTokenizer tok = new StringTokenizer(in.readLine());
		int[] vals = new int[n];
		int[] diff = new int[n-1];
		long[] sums = new long[n-1];
		vals[0] = Integer.parseInt(tok.nextToken());
		long pSum = 0;
		long maxSum = Integer.MIN_VALUE;
		int maxI = 0;
		long minSum = Integer.MAX_VALUE;
		int minI = 0;
		for (int i = 1; i < n; i++) {
			vals[i] = Integer.parseInt(tok.nextToken());
			diff[i-1] = vals[i] - vals[i-1];
			if (diff[i-1] < 0) {
				diff[i-1] *= -1;
			}

			if (i%2==1) {
				pSum += diff[i-1];
			} else {
				pSum -= diff[i-1];
			}
			sums[i-1] = pSum;
			if (pSum > maxSum) {
				maxSum = pSum;
				maxI = i;
			}
			if (pSum < minSum) {
				minSum = pSum;
				minI = i;
			}
			//System.out.println(pSum);
		}

		//System.out.println(maxI);
		if (minSum < 0) {
			System.out.println(maxSum-minSum);
		} else {
			System.out.println(maxSum);
		}
	}
}


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

public class C789 {
	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(in.readLine());
		StringTokenizer tok = new StringTokenizer(in.readLine());
		int[] vals = new int[n];
		int[] diff = new int[n-1];
		int[] sums = new int[n-1];
		vals[0] = Integer.parseInt(tok.nextToken());
		int pSum = 0;
		int maxSum = Integer.MIN_VALUE;
		for (int i = 1; i < n; i++) {
			vals[i] = Integer.parseInt(tok.nextToken());
			diff[i-1] = vals[i] - vals[i-1];
			if (diff[i-1] < 0) {
				diff[i-1] *= -1;
			}

			if (i%2==1) {
				pSum += diff[i-1];
			} else {
				pSum -= diff[i-1];
			}
			sums[i-1] = pSum;
			if (pSum > maxSum) maxSum = pSum;
			//System.out.println(pSum);
		}

		System.out.println(maxSum);
	}
}


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

public class C789 {
	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(in.readLine());
		StringTokenizer tok = new StringTokenizer(in.readLine());
		int[] vals = new int[n];
		int[] diff = new int[n-1];
		int[] sums = new int[n-1];
		vals[0] = Integer.parseInt(tok.nextToken());
		int pSum = 0;
		int maxSum = Integer.MIN_VALUE;
		int maxI = 0;
		int minSum = Integer.MAX_VALUE;
		int minI = 0;
		for (int i = 1; i < n; i++) {
			vals[i] = Integer.parseInt(tok.nextToken());
			diff[i-1] = vals[i] - vals[i-1];
			if (diff[i-1] < 0) {
				diff[i-1] *= -1;
			}

			if (i%2==1) {
				pSum += diff[i-1];
			} else {
				pSum -= diff[i-1];
			}
			sums[i-1] = pSum;
			if (pSum > maxSum) {
				maxSum = pSum;
				maxI = i;
			}
			if (pSum < minSum) {
				minSum = pSum;
				minI = i;
			}
			//System.out.println(pSum);
		}

		//System.out.println(maxI);
		if (minSum < 0) {
			System.out.println(maxSum-minSum);
		} else {
			System.out.println(maxSum);
		}
	}
}


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

public class C789 {
	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(in.readLine());
		StringTokenizer tok = new StringTokenizer(in.readLine());
		int[] vals = new int[n];
		int[] diff = new int[n-1];
		int[] sums = new int[n-1];
		vals[0] = Integer.parseInt(tok.nextToken());
		int pSum = 0;
		int maxSum = Integer.MIN_VALUE;
		int maxI = 0;
		int minSum = Integer.MAX_VALUE;
		int minI = 0;
		for (int i = 1; i < n; i++) {
			vals[i] = Integer.parseInt(tok.nextToken());
			diff[i-1] = vals[i] - vals[i-1];
			if (diff[i-1] < 0) {
				diff[i-1] *= -1;
			}

			if (i%2==1) {
				pSum += diff[i-1];
			} else {
				pSum -= diff[i-1];
			}
			sums[i-1] = pSum;
			if (pSum > maxSum) {
				maxSum = pSum;
				maxI = i;
			}
			if (pSum < minSum) {
				minSum = pSum;
				minI = i;
			}
			//System.out.println(pSum);
		}

		if (minSum < 0 && maxI > minI) {
			System.out.println(maxSum-minSum);
		} else {
			System.out.println(maxSum);
		}
	}
}


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

public class C789 {
	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(in.readLine());
		StringTokenizer tok = new StringTokenizer(in.readLine());
		int[] vals = new int[n];
		vals[0] = Integer.parseInt(tok.nextToken());
		long pSum = 0;
		long maxSum = Integer.MIN_VALUE;
		long minSum = Integer.MAX_VALUE;
		for (int i = 1; i < n; i++) {
			vals[i] = Integer.parseInt(tok.nextToken());
			long diff = vals[i] - vals[i-1];
			if (diff < 0) {
				diff *= -1;
			}

			if (i%2==1) {
				pSum += diff;
			} else {
				pSum -= diff;
			}
			if (pSum > maxSum) {
				maxSum = pSum;
			}
			if (pSum < minSum) {
				minSum = pSum;
			}
		}

		if (minSum < 0) {
			System.out.println(maxSum-minSum);
		} else {
			System.out.println(maxSum);
		}
	}
}


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

public class C789 {
	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(in.readLine());
		StringTokenizer tok = new StringTokenizer(in.readLine());
		int[] vals = new int[n];
		int[] diff = new int[n-1];
		int[] sums = new int[n-1];
		vals[0] = Integer.parseInt(tok.nextToken());
		int pSum = 0;
		int maxSum = Integer.MIN_VALUE;
		int maxI = 0;
		int minSum = Integer.MAX_VALUE;
		int minI = 0;
		for (int i = 1; i < n; i++) {
			vals[i] = Integer.parseInt(tok.nextToken());
			diff[i-1] = vals[i] - vals[i-1];
			if (diff[i-1] < 0) {
				diff[i-1] *= -1;
			}

			if (i%2==1) {
				pSum += diff[i-1];
			} else {
				pSum -= diff[i-1];
			}
			sums[i-1] = pSum;
			if (pSum > maxSum) {
				maxSum = pSum;
				maxI = i;
			}
			if (pSum < minSum) {
				minSum = pSum;
				minI = i;
			}
			//System.out.println(pSum);
		}

		if (minSum < 0 && maxI > maxI) {
			System.out.println(maxSum-minSum);
		} else {
			System.out.println(maxSum);
		}
	}
}


import java.util.*;
import java.io.*;
import java.math.*;
public class Main
{
    static class Reader
    {
        private InputStream mIs;private byte[] buf = new byte[1024];private int curChar,numChars;public Reader() { this(System.in); }public Reader(InputStream is) { mIs = is;}
        public int read() {if (numChars == -1) throw new InputMismatchException();if (curChar >= numChars) {curChar = 0;try { numChars = mIs.read(buf);} catch (IOException e) { throw new InputMismatchException();}if (numChars <= 0) return -1; }return buf[curChar++];}
        public 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() ;}
        public String s(){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 long l(){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 int i(){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 double d() throws IOException {return Double.parseDouble(s()) ;}
        public boolean isSpaceChar(int c) { return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; }
        public boolean isEndOfLine(int c) { return c == '\n' || c == '\r' || c == -1; }
    }

    ///////////////////////////////////////////////////////////////////////////////////////////
    //    RRRRRRRRR            AAA             HHH     HHH     IIIIIIIIIIIII   LLL           //
    //    RR    RRR           AAAAA            HHH     HHH      IIIIIIIIIII    LLL           //
    //    RR   RRR           AAAAAAA           HHH     HHH          III        LLL           //
    //    RR  RRR           AAA   AAA          HHHHHHHHHHH          III        LLL           //
    //    RRRRRR           AAA     AAA         HHHHHHHHHHH          III        LLL           //
    //    RR  RRR         AAAAAAAAAAAAA        HHH     HHH          III        LLL           //
    //    RR    RRR      AAA         AAA       HHH     HHH      IIIIIIIIIII    LLLLLLLLLLLL  //
    //    RR     RRR    AAA           AAA      HHH     HHH     IIIIIIIIIIIII   LLLLLLLLLLLL  //
    ///////////////////////////////////////////////////////////////////////////////////////////
    static int n;
    static int arr[];
    public static void main(String[] args)throws IOException
    {
        PrintStream out= new PrintStream(System.out);
        Reader sc=new Reader();
        n=sc.i();
        arr=new int[n];
        for(int i=0;i<n;i++)arr[i]=sc.i();
        int sum1=0;int sum2=0;int max1=0;int max2=0;
        for(int i=0;i<n-1;i++)
        {
            if(i%2==0)sum1+=Math.abs(arr[i]-arr[i+1]);
            else sum1-=Math.abs(arr[i+1]-arr[i]);
            max1=Math.max(max1,sum1);
            if(sum1<0)sum1=0;
        }
        for(int i=1;i<n-1;i++)
        {
            if(i%2==1)sum2+=Math.abs(arr[i]-arr[i+1]);
            else sum2-=Math.abs(arr[i+1]-arr[i]);
            max2=Math.max(max2,sum2);
            if(sum2<0)sum2=0;
        }
        System.out.println(Math.max(max1,max2));
    }
}


import java.util.*;
import java.io.*;
import java.math.*;
public class Main
{
    static class Reader
    {
        private InputStream mIs;private byte[] buf = new byte[1024];private int curChar,numChars;public Reader() { this(System.in); }public Reader(InputStream is) { mIs = is;}
        public int read() {if (numChars == -1) throw new InputMismatchException();if (curChar >= numChars) {curChar = 0;try { numChars = mIs.read(buf);} catch (IOException e) { throw new InputMismatchException();}if (numChars <= 0) return -1; }return buf[curChar++];}
        public 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() ;}
        public String s(){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 long l(){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 int i(){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 double d() throws IOException {return Double.parseDouble(s()) ;}
        public boolean isSpaceChar(int c) { return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; }
        public boolean isEndOfLine(int c) { return c == '\n' || c == '\r' || c == -1; }
    }

    ///////////////////////////////////////////////////////////////////////////////////////////
    //    RRRRRRRRR            AAA             HHH     HHH     IIIIIIIIIIIII   LLL           //
    //    RR    RRR           AAAAA            HHH     HHH      IIIIIIIIIII    LLL           //
    //    RR   RRR           AAAAAAA           HHH     HHH          III        LLL           //
    //    RR  RRR           AAA   AAA          HHHHHHHHHHH          III        LLL           //
    //    RRRRRR           AAA     AAA         HHHHHHHHHHH          III        LLL           //
    //    RR  RRR         AAAAAAAAAAAAA        HHH     HHH          III        LLL           //
    //    RR    RRR      AAA         AAA       HHH     HHH      IIIIIIIIIII    LLLLLLLLLLLL  //
    //    RR     RRR    AAA           AAA      HHH     HHH     IIIIIIIIIIIII   LLLLLLLLLLLL  //
    ///////////////////////////////////////////////////////////////////////////////////////////
    static int n;
    static int arr[];
    public static void main(String[] args)throws IOException
    {
        PrintStream out= new PrintStream(System.out);
        Reader sc=new Reader();
        n=sc.i();
        arr=new int[n];
        for(int i=0;i<n;i++)arr[i]=sc.i();
        long sum1=0;long sum2=0;long max1=0;long max2=0;
        for(int i=0;i<n-1;i++)
        {
            if(i%2==0)sum1+=(long)Math.abs(arr[i]-arr[i+1]);
            else sum1-=(long)Math.abs(arr[i+1]-arr[i]);
            max1=Math.max(max1,sum1);
            if(sum1<0)sum1=0;
        }
        for(int i=1;i<n-1;i++)
        {
            if(i%2==1)sum2+=(long)Math.abs(arr[i]-arr[i+1]);
            else sum2-=(long)Math.abs(arr[i+1]-arr[i]);
            max2=Math.max(max2,sum2);
            if(sum2<0)sum2=0;
        }
        System.out.println(Math.max(max1,max2));
    }
}


import java.util.*;
import java.io.*;
import java.math.*;
public class Main
{
    static class Reader
    {
        private InputStream mIs;private byte[] buf = new byte[1024];private int curChar,numChars;public Reader() { this(System.in); }public Reader(InputStream is) { mIs = is;}
        public int read() {if (numChars == -1) throw new InputMismatchException();if (curChar >= numChars) {curChar = 0;try { numChars = mIs.read(buf);} catch (IOException e) { throw new InputMismatchException();}if (numChars <= 0) return -1; }return buf[curChar++];}
        public 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() ;}
        public String s(){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 long l(){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 int i(){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 double d() throws IOException {return Double.parseDouble(s()) ;}
        public boolean isSpaceChar(int c) { return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; }
        public boolean isEndOfLine(int c) { return c == '\n' || c == '\r' || c == -1; }
    }

    ///////////////////////////////////////////////////////////////////////////////////////////
    //    RRRRRRRRR            AAA             HHH     HHH     IIIIIIIIIIIII   LLL           //
    //    RR    RRR           AAAAA            HHH     HHH      IIIIIIIIIII    LLL           //
    //    RR   RRR           AAAAAAA           HHH     HHH          III        LLL           //
    //    RR  RRR           AAA   AAA          HHHHHHHHHHH          III        LLL           //
    //    RRRRRR           AAA     AAA         HHHHHHHHHHH          III        LLL           //
    //    RR  RRR         AAAAAAAAAAAAA        HHH     HHH          III        LLL           //
    //    RR    RRR      AAA         AAA       HHH     HHH      IIIIIIIIIII    LLLLLLLLLLLL  //
    //    RR     RRR    AAA           AAA      HHH     HHH     IIIIIIIIIIIII   LLLLLLLLLLLL  //
    ///////////////////////////////////////////////////////////////////////////////////////////
    static int n;
    static int arr[];
    public static void main(String[] args)throws IOException
    {
        PrintStream out= new PrintStream(System.out);
        Reader sc=new Reader();
        n=sc.i();
        arr=new int[n];
        for(int i=0;i<n;i++)arr[i]=sc.i();
        int sum1=0;int sum2=0;int max1=0;int max2=0;
        for(int i=0;i<n-1;i++)
        {
            if(i%2==0)sum1+=Math.abs(arr[i]-arr[i+1]);
            else sum1-=Math.abs(arr[i+1]-arr[i]);
            max1=Math.max(max1,sum1);
            if(sum1<0)sum1=0;
        }
        for(int i=1;i<n-1;i++)
        {
            if(i%2==1)sum2+=Math.abs(arr[i]-arr[i+1]);
            else sum2-=Math.abs(arr[i+1]-arr[i]);
            max2=Math.max(max2,sum2);
            if(sum2<0)sum2=0;
        }
        System.out.println(Math.max(sum1,sum2));
    }
}


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

public class Codeforces {

    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);

        int n = in.nextInt();
        long[] arr = in.nextLongArr(n);

        long[][] dp = new long[arr.length][2];
        dp[1][0] = 0;
        dp[1][1] = Math.abs(arr[0] -  arr[1]);

        for (int i = 2; i < arr.length; i++) {
            dp[i][0] = dp[i - 1][1] - Math.abs(arr[i - 1] - arr[i]);
            dp[i][1] = dp[i - 1][0] + Math.abs(arr[i - 1] - arr[i]);
        }

        long res = Integer.MIN_VALUE;
        for (int i = 1; i < arr.length; i++) {
            res = Math.max(res, dp[i][0]);
            res = Math.max(res, dp[i][1]);
        }

        out.println(res);
        out.close();
    }

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

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

        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 String nextLine() {
            try {
                return reader.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }

            return null;
        }

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

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

        public int[] nextIntArr(int n) {
            int[] arr = new int[n];
            for (int j = 0; j < arr.length; j++) {
                arr[j] = nextInt();
            }

            return arr;
        }

        public long[] nextLongArr(int n) {
            long[] arr = new long[n];
            for (int j = 0; j < arr.length; j++) {
                arr[j] = nextLong();
            }

            return arr;
        }
    }
}


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

public class Codeforces {

    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);

        int n = in.nextInt();
        long[] arr = in.nextLongArr(n);

        long[][] dp = new long[arr.length][2];
        dp[1][0] = 0;
        dp[1][1] = Math.abs(arr[0] -  arr[1]);

        for (int i = 2; i < arr.length; i++) {
            dp[i][0] = Math.max(0, dp[i - 1][1] - Math.abs(arr[i - 1] - arr[i]));
            dp[i][1] = Math.max(Math.abs(arr[i - 1] - arr[i]), dp[i - 1][0] + Math.abs(arr[i - 1] - arr[i]));
        }

        long res = Integer.MIN_VALUE;
        for (int i = 1; i < arr.length; i++) {
            res = Math.max(res, dp[i][0]);
            res = Math.max(res, dp[i][1]);
        }

        out.println(res);
        out.close();
    }

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

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

        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 String nextLine() {
            try {
                return reader.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }

            return null;
        }

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

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

        public int[] nextIntArr(int n) {
            int[] arr = new int[n];
            for (int j = 0; j < arr.length; j++) {
                arr[j] = nextInt();
            }

            return arr;
        }

        public long[] nextLongArr(int n) {
            long[] arr = new long[n];
            for (int j = 0; j < arr.length; j++) {
                arr[j] = nextLong();
            }

            return arr;
        }
    }
}


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

public class C {
	final static int MOD = 1000000007;

	public static void main(String[] args) throws Exception {
		FastReader in = new FastReader(System.in);
		int n = in.nextInt();
		long[] a = new long[n], D = new long[n - 1];
		for (int i = 0; i < n; i++) {
			a[i] = in.nextLong();
		}
		for (int i = 0; i < n - 1; i++) {
			D[i] = Math.abs(a[i + 1] - a[i]);
		}
		if (n == 2) {
			System.out.println(D[0]);
		}
		long max = D[0];
		long cur = D[0];
		for (int i = 2; i < n - 1; i += 2) {
			if (cur - D[i - 1] < 0) {
				cur = 0;
			}
			cur += D[i] - D[i - 1];
			max = Math.max(max, cur);
		}
		cur = D[1];
		max = Math.max(max, cur);
		for (int i = 3; i < n - 1; i += 2) {
			if (cur - D[i - 1] < 0) {
				cur = 0;
			}
			cur += D[i] - D[i - 1];
			max = Math.max(max, cur);
		}
		System.out.println(max);
	}

	static class FastReader {
	    private boolean finished = false;

	    private InputStream stream;
	    private byte[] buf = new byte[1024];
	    private int curChar;
	    private int numChars;
	    private SpaceCharFilter filter;

	    public FastReader(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 int peek() {
	        if (numChars == -1) {
	            return -1;
	        }
	        if (curChar >= numChars) {
	            curChar = 0;
	            try {
	                numChars = stream.read(buf);
	            } catch (IOException e) {
	                return -1;
	            }
	            if (numChars <= 0) {
	                return -1;
	            }
	        }
	        return buf[curChar];
	    }

	    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 == ',') {
	                c = read();
	            }
	            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 String nextString() {
	        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 isWhitespace(c);
	    }

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

	    private String readLine0() {
	        StringBuilder buf = new StringBuilder();
	        int c = read();
	        while (c != '\n' && c != -1) {
	            if (c != '\r') {
	                buf.appendCodePoint(c);
	            }
	            c = read();
	        }
	        return buf.toString();
	    }

	    public String nextLine() {
	        String s = readLine0();
	        while (s.trim().length() == 0)
	            s = readLine0();
	        return s;
	    }

	    public String nextLine(boolean ignoreEmptyLines) {
	        if (ignoreEmptyLines) {
	            return nextLine();
	        } else {
	            return readLine0();
	        }
	    }

	    public BigInteger nextBigInteger() {
	        try {
	            return new BigInteger(nextString());
	        } catch (NumberFormatException e) {
	            throw new InputMismatchException();
	        }
	    }

	    public char nextCharacter() {
	        int c = read();
	        while (isSpaceChar(c))
	            c = read();
	        return (char) c;
	    }

	    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 boolean isExhausted() {
	        int value;
	        while (isSpaceChar(value = peek()) && value != -1)
	            read();
	        return value == -1;
	    }

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

	    public SpaceCharFilter getFilter() {
	        return filter;
	    }

	    public void setFilter(SpaceCharFilter filter) {
	        this.filter = filter;
	    }

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


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

public class C {
	final static int MOD = 1000000007;

	public static void main(String[] args) throws Exception {
		FastReader in = new FastReader(System.in);
		int n = in.nextInt();
		long[] a = new long[n], D = new long[n - 1];
		for (int i = 0; i < n; i++) {
			a[i] = in.nextLong();
		}
		for (int i = 0; i < n - 1; i++) {
			D[i] = Math.abs(a[i + 1] - a[i]);
		}
		if (n == 2) {
			System.out.println(D[0]);
			return;
		}
		long max = D[0];
		long cur = D[0];
		for (int i = 2; i < n - 1; i += 2) {
			if (cur - D[i - 1] < 0) {
				cur = 0;
			}
			cur += D[i] - D[i - 1];
			max = Math.max(max, cur);
		}
		cur = D[1];
		max = Math.max(max, cur);
		for (int i = 3; i < n - 1; i += 2) {
			if (cur - D[i - 1] < 0) {
				cur = 0;
			}
			cur += D[i] - D[i - 1];
			max = Math.max(max, cur);
		}
		System.out.println(max);
	}

	static class FastReader {
	    private boolean finished = false;

	    private InputStream stream;
	    private byte[] buf = new byte[1024];
	    private int curChar;
	    private int numChars;
	    private SpaceCharFilter filter;

	    public FastReader(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 int peek() {
	        if (numChars == -1) {
	            return -1;
	        }
	        if (curChar >= numChars) {
	            curChar = 0;
	            try {
	                numChars = stream.read(buf);
	            } catch (IOException e) {
	                return -1;
	            }
	            if (numChars <= 0) {
	                return -1;
	            }
	        }
	        return buf[curChar];
	    }

	    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 == ',') {
	                c = read();
	            }
	            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 String nextString() {
	        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 isWhitespace(c);
	    }

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

	    private String readLine0() {
	        StringBuilder buf = new StringBuilder();
	        int c = read();
	        while (c != '\n' && c != -1) {
	            if (c != '\r') {
	                buf.appendCodePoint(c);
	            }
	            c = read();
	        }
	        return buf.toString();
	    }

	    public String nextLine() {
	        String s = readLine0();
	        while (s.trim().length() == 0)
	            s = readLine0();
	        return s;
	    }

	    public String nextLine(boolean ignoreEmptyLines) {
	        if (ignoreEmptyLines) {
	            return nextLine();
	        } else {
	            return readLine0();
	        }
	    }

	    public BigInteger nextBigInteger() {
	        try {
	            return new BigInteger(nextString());
	        } catch (NumberFormatException e) {
	            throw new InputMismatchException();
	        }
	    }

	    public char nextCharacter() {
	        int c = read();
	        while (isSpaceChar(c))
	            c = read();
	        return (char) c;
	    }

	    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 boolean isExhausted() {
	        int value;
	        while (isSpaceChar(value = peek()) && value != -1)
	            read();
	        return value == -1;
	    }

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

	    public SpaceCharFilter getFilter() {
	        return filter;
	    }

	    public void setFilter(SpaceCharFilter filter) {
	        this.filter = filter;
	    }

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


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

public class C {
	final static int MOD = 1000000007;

	public static void main(String[] args) throws Exception {
		FastReader in = new FastReader(System.in);
		int n = in.nextInt();
		long[] a = new long[n], D = new long[n - 1];
		for (int i = 0; i < n; i++) {
			a[i] = in.nextLong();
		}
		for (int i = 0; i < n - 1; i++) {
			D[i] = Math.abs(a[i + 1] - a[i]);
		}
		if (n == 2) {
			System.out.println(D[0]);
			return;
		}
		long max = D[0];
		long cur = D[0];
		for (int i = 2; i < n - 1; i += 2) {
			if (cur - D[i - 1] < 0) {
				cur = 0;
			} else {
				cur -= D[i - 1];
			}
			cur += D[i];
			max = Math.max(max, cur);
		}
		cur = D[1];
		max = Math.max(max, cur);
		for (int i = 3; i < n - 1; i += 2) {
			if (cur - D[i - 1] < 0) {
				cur = 0;
			} else {
				cur -= D[i - 1];
			}
			cur += D[i];
			max = Math.max(max, cur);
		}
		System.out.println(max);
	}

	static class FastReader {
	    private boolean finished = false;

	    private InputStream stream;
	    private byte[] buf = new byte[1024];
	    private int curChar;
	    private int numChars;
	    private SpaceCharFilter filter;

	    public FastReader(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 int peek() {
	        if (numChars == -1) {
	            return -1;
	        }
	        if (curChar >= numChars) {
	            curChar = 0;
	            try {
	                numChars = stream.read(buf);
	            } catch (IOException e) {
	                return -1;
	            }
	            if (numChars <= 0) {
	                return -1;
	            }
	        }
	        return buf[curChar];
	    }

	    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 == ',') {
	                c = read();
	            }
	            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 String nextString() {
	        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 isWhitespace(c);
	    }

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

	    private String readLine0() {
	        StringBuilder buf = new StringBuilder();
	        int c = read();
	        while (c != '\n' && c != -1) {
	            if (c != '\r') {
	                buf.appendCodePoint(c);
	            }
	            c = read();
	        }
	        return buf.toString();
	    }

	    public String nextLine() {
	        String s = readLine0();
	        while (s.trim().length() == 0)
	            s = readLine0();
	        return s;
	    }

	    public String nextLine(boolean ignoreEmptyLines) {
	        if (ignoreEmptyLines) {
	            return nextLine();
	        } else {
	            return readLine0();
	        }
	    }

	    public BigInteger nextBigInteger() {
	        try {
	            return new BigInteger(nextString());
	        } catch (NumberFormatException e) {
	            throw new InputMismatchException();
	        }
	    }

	    public char nextCharacter() {
	        int c = read();
	        while (isSpaceChar(c))
	            c = read();
	        return (char) c;
	    }

	    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 boolean isExhausted() {
	        int value;
	        while (isSpaceChar(value = peek()) && value != -1)
	            read();
	        return value == -1;
	    }

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

	    public SpaceCharFilter getFilter() {
	        return filter;
	    }

	    public void setFilter(SpaceCharFilter filter) {
	        this.filter = filter;
	    }

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


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

public class Solution{

	static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new
                     InputStreamReader(System.in));
        }

        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException  e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

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

        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }

    static long ninf = Long.MIN_VALUE;

	public static void main(String[] args){
		FastReader sc = new FastReader();
		int n = sc.nextInt();
		long[] arr = new long[n];

		for(int i=0;i<n;i++)
			arr[i] = sc.nextLong();

		for(int i=0;i<n-1;i++){
			arr[i] = Math.abs(arr[i]-arr[i+1]);
			arr[i] *= ((i%2==0)?1:-1);
		}
		arr[n-1]=0;

		long max_ans=ninf, cur=0;
		for(int i=0;i<n;i++){
			cur+=arr[i];
			if(cur<0)
				cur=0;
			max_ans = Math.max(max_ans, cur);
		}

		cur=0;
		for(int i=0;i<n;i++){
			arr[i] *= (-1);
		}

		for(int i=0;i<n;i++){
			cur+=arr[i];
			if(cur<0)
				cur=0;
			max_ans = Math.max(max_ans, cur);
		}

		System.out.println(max_ans);
	}
}


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

public class Abood2C {

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		int n = sc.nextInt();

		long[] t = new long[n];

		for (int i = 0; i < n; i++)
			t[i] = sc.nextInt();

		long[] d = new long[n - 1];

		for (int i = 1; i < n; i++) {
			d[i - 1] = Math.abs(t[i] - t[i - 1]);
		}

		long ans = 0;

		long sum = 0;
		for (int i = 0; i < d.length; i++) {
			long v = d[i] * (i % 2 == 0 ? 1 : -1);

			sum = Math.max(0, sum + v);
			ans = Math.max(ans, sum);
		}

		sum = 0;

		for (int i = 1; i < d.length; i++) {
			long v = d[i] * (i % 2 == 1 ? 1 : -1);

			sum = Math.max(0, sum + v);
			ans = Math.max(ans, sum);
		}

		out.println(ans);
		out.flush();

	}

	static class Scanner

	{
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

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

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

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

		public String nextLine() throws IOException {return br.readLine();}

		public double nextDouble() throws IOException
		{
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if(x.charAt(0) == '-')
			{
				neg = true;
				start++;
			}
			for(int i = start; i < x.length(); i++)
				if(x.charAt(i) == '.')
				{
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				}
				else
				{
					sb.append(x.charAt(i));
					if(dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg?-1:1);
		}

		public boolean ready() throws IOException {return br.ready();}

	}

}


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

public class Abood2C {

	public static void main(String[] args) throws IOException {
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		int n = sc.nextInt();

		int[] t = new int[n];

		for (int i = 0; i < n; i++)
			t[i] = sc.nextInt();

		int[] d = new int[n - 1];

		for (int i = 1; i < n; i++) {
			d[i - 1] = Math.abs(t[i] - t[i - 1]);
		}

		int ans = 0;

		int sum = 0;
		for (int i = 0; i < d.length; i++) {
			int v = d[i] * (i % 2 == 0 ? 1 : -1);

			sum = Math.max(0, sum + v);
			ans = Math.max(ans, sum);
		}

		sum = 0;

		for (int i = 1; i < d.length; i++) {
			int v = d[i] * (i % 2 == 1 ? 1 : -1);

			sum = Math.max(0, sum + v);
			ans = Math.max(ans, sum);
		}

		out.println(ans);
		out.flush();

	}

	static class Scanner

	{
		StringTokenizer st;
		BufferedReader br;

		public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}

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

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

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

		public String nextLine() throws IOException {return br.readLine();}

		public double nextDouble() throws IOException
		{
			String x = next();
			StringBuilder sb = new StringBuilder("0");
			double res = 0, f = 1;
			boolean dec = false, neg = false;
			int start = 0;
			if(x.charAt(0) == '-')
			{
				neg = true;
				start++;
			}
			for(int i = start; i < x.length(); i++)
				if(x.charAt(i) == '.')
				{
					res = Long.parseLong(sb.toString());
					sb = new StringBuilder("0");
					dec = true;
				}
				else
				{
					sb.append(x.charAt(i));
					if(dec)
						f *= 10;
				}
			res += Long.parseLong(sb.toString()) / f;
			return res * (neg?-1:1);
		}

		public boolean ready() throws IOException {return br.ready();}

	}

}


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

public class utkarsh {

    InputStream is;
    PrintWriter out;

    long maxl = 1234567890987654321L, mod = 1000000007L;
    int p[], maxi = 1234567890, sz, np = 20000000;
    boolean b[];    // = isPrime();

    void solve(){
        //Enter code here utkarsh
        //sz=sieve(); //sz=1270607;
        //out.println(sz);
        int i, n;
        n = ni();
        long a[] = new long[n];
        for(i = 0; i < n; i++){
            a[i] = nl();
        }
        if(n == 1){
            out.println(Math.abs(a[0]));
            return;
        }
        long x, y, m;
        x = y = m = 0L;
        for(i = 0; i < n-1; i++){
            if(i % 2 == 0){
                x += Math.abs(a[i] - a[i+1]);
                y -= Math.abs(a[i] - a[i+1]);
            }else{
                x -= Math.abs(a[i] - a[i+1]);
                y += Math.abs(a[i] - a[i+1]);
            }
            if(x < 0L)  x = 0L;
            if(y < 0L)  y = 0L;
            m = Math.max(m, x);
            m = Math.max(m, y);
        }
        out.println(m);
    }

    int sieve(){ int i, j, n = 20000000; b = new boolean[n]; for(i = 3; i < n; i += 2){ b[i] = true; } b[2] = true; for(i = 3; i * i <= n; i += 2){ if(b[i]){ for(j = 2 * i; j < n; j += i){ b[j] = false; } } } p = new int[n]; p[0] = 2; j = 1; for(i = 3; i < n; i += 2){ if(b[i]){ p[j++] = i; } } p=Arrays.copyOf(p,j); return j;
    }
    long modpow(long base, long exp, long modulus) { base %= modulus; long result = 1L; while (exp > 0) { if ((exp & 1)==1) result = (result * base) % modulus; base = (base * base) % modulus; exp >>= 1; } return result;
    }

    public static void main(String[] args) { new utkarsh().run();
    }
    void run(){ is = System.in; out = new PrintWriter(System.out); solve(); out.flush();
    }

    byte input[] = new byte[1024];
    int len = 0, ptr = 0;

    int readByte(){ if(ptr >= len){ ptr = 0; try{ len = is.read(input); }catch(IOException e){ throw new InputMismatchException(); } if(len <= 0){ return -1; } } return input[ptr++];
    }
    boolean isSpaceChar(int c){ return !( c >= 33 && c <= 126 );
    }
    int skip(){ int b = readByte(); while(b != -1 && isSpaceChar(b)){ b = readByte(); } return b;
    }

    char nc(){ return (char)skip();
    }
    String ns(){ int b = skip(); StringBuilder sb = new StringBuilder(); while(!isSpaceChar(b)){ sb.appendCodePoint(b); b=readByte(); } return sb.toString();
    }
    int ni(){ int n = 0,b = readByte(); boolean minus = false; while(b != -1 && !( (b >= '0' && b <= '9') || b == '-')){ b = readByte(); } if(b == '-'){ minus = true; b = readByte(); } if(b == -1){ return -1; } while(b >= '0' && b <= '9'){ n = n * 10 + (b - '0'); b = readByte(); } return minus ? -n : n;
    }
    long nl(){ long n = 0L; int b = readByte(); boolean minus = false; while(b != -1 && !( (b >= '0' && b <= '9') || b == '-')){ b = readByte(); } if(b == '-'){ minus = true; b = readByte(); } while(b >= '0' && b <= '9'){ n = n * 10 + (b - '0'); b = readByte(); } return minus ? -n : n;
    }
    double nd(){ return Double.parseDouble(ns());
    }
    float nf(){ return Float.parseFloat(ns());
    }
    int[] na(int n){ int a[] = new int[n]; for(int i = 0; i < n; i++){ a[i] = ni(); } return a;
    }
    char[] ns(int n){ char c[] = new char[n]; int i,b = skip(); for(i = 0; i < n; i++){ if(isSpaceChar(b)){ break; } c[i] = (char)b; b = readByte(); } return i == n ? c : Arrays.copyOf(c,i);
    }
}


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

public class utkarsh {

    InputStream is;
    PrintWriter out;

    long maxl = 1234567890987654321L, mod = 1000000007L;
    int p[], maxi = 1234567890, sz, np = 20000000;
    boolean b[];    // = isPrime();

    void solve(){
        //Enter code here utkarsh
        //sz=sieve(); //sz=1270607;
        //out.println(sz);
        int i, j, n;
        n = ni();
        long a[] = new long[n];
        for(i = 0; i < n; i++){
            a[i] = nl();
        }
        for(i = 0; i < n-1; i++){
            a[i] = Math.abs(a[i] - a[i + 1]);
            //out.println(a[i]);
        }
        a[n - 1] = 0;
        n--;
        long ans, ans1;
        ans = ans1 = 0;
        for(i = 0; i < n; i++){
            if(i % 2 == 0){
                ans += a[i];
            }else{
                ans -= a[i];
            }
            if(ans < 0){
                ans = 0;
            }
        }
        for(i = 0; i < n; i++){
            if(i % 2 == 1){
                ans1 += a[i];
            }else{
                ans1 -= a[i];
            }
            if(ans1 < 0){
                ans1 = 0;
            }
        }
        out.println(Math.max(ans, ans1));
    }

    int sieve(){ int i, j, n = 20000000; b = new boolean[n]; for(i = 3; i < n; i += 2){ b[i] = true; } b[2] = true; for(i = 3; i * i <= n; i += 2){ if(b[i]){ for(j = 2 * i; j < n; j += i){ b[j] = false; } } } p = new int[n]; p[0] = 2; j = 1; for(i = 3; i < n; i += 2){ if(b[i]){ p[j++] = i; } } p=Arrays.copyOf(p,j); return j;
    }
    long modpow(long base, long exp, long modulus) { base %= modulus; long result = 1L; while (exp > 0) { if ((exp & 1)==1) result = (result * base) % modulus; base = (base * base) % modulus; exp >>= 1; } return result;
    }

    public static void main(String[] args) { new utkarsh().run();
    }
    void run(){ is = System.in; out = new PrintWriter(System.out); solve(); out.flush();
    }

    byte input[] = new byte[1024];
    int len = 0, ptr = 0;

    int readByte(){ if(ptr >= len){ ptr = 0; try{ len = is.read(input); }catch(IOException e){ throw new InputMismatchException(); } if(len <= 0){ return -1; } } return input[ptr++];
    }
    boolean isSpaceChar(int c){ return !( c >= 33 && c <= 126 );
    }
    int skip(){ int b = readByte(); while(b != -1 && isSpaceChar(b)){ b = readByte(); } return b;
    }

    char nc(){ return (char)skip();
    }
    String ns(){ int b = skip(); StringBuilder sb = new StringBuilder(); while(!isSpaceChar(b)){ sb.appendCodePoint(b); b=readByte(); } return sb.toString();
    }
    int ni(){ int n = 0,b = readByte(); boolean minus = false; while(b != -1 && !( (b >= '0' && b <= '9') || b == '-')){ b = readByte(); } if(b == '-'){ minus = true; b = readByte(); } if(b == -1){ return -1; } while(b >= '0' && b <= '9'){ n = n * 10 + (b - '0'); b = readByte(); } return minus ? -n : n;
    }
    long nl(){ long n = 0L; int b = readByte(); boolean minus = false; while(b != -1 && !( (b >= '0' && b <= '9') || b == '-')){ b = readByte(); } if(b == '-'){ minus = true; b = readByte(); } while(b >= '0' && b <= '9'){ n = n * 10 + (b - '0'); b = readByte(); } return minus ? -n : n;
    }
    double nd(){ return Double.parseDouble(ns());
    }
    float nf(){ return Float.parseFloat(ns());
    }
    int[] na(int n){ int a[] = new int[n]; for(int i = 0; i < n; i++){ a[i] = ni(); } return a;
    }
    char[] ns(int n){ char c[] = new char[n]; int i,b = skip(); for(i = 0; i < n; i++){ if(isSpaceChar(b)){ break; } c[i] = (char)b; b = readByte(); } return i == n ? c : Arrays.copyOf(c,i);
    }
}