
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.Arrays;

public final class Main {

  private Main() {}

  public static int readCount(Reader reader) throws Exception {
    char[] buffer = new char[3];
    int bIndex = 0;

    for (;;) {
      int read = reader.read();
      if (read == '\r' || read == ' ') continue;
      if (read == '\n') return Integer.parseInt(String.valueOf(buffer, 0, bIndex));
      buffer[bIndex++] = (char) read;
    }
  }

  private static int[] parse(int count, Reader reader) throws Exception {
    char[] buffer = new char[10];
    int bIndex = 0;

    int[] result = new int[count];
    int rIndex = 0;

    for (;;) {
      int read = reader.read();
      if (read == '\r') continue;
      if (read == -1)
        return Arrays.copyOf(result, rIndex);

      char c = (char) read;
      if (c == '\n' || c == ' ') {
        if (bIndex != 0) {
          result[rIndex++] = Integer.parseInt(String.valueOf(buffer, 0, bIndex));
          bIndex = 0;
        }
        if (c == '\n') { return Arrays.copyOf(result, rIndex); }
        continue;
      }
      buffer[bIndex++] = c;
    }
  }

  public static void main(String[] args) throws Exception {
    final Reader reader = new InputStreamReader(System.in);

    final int length = readCount(reader);
    final int[] inputs = parse(length, reader);

    int max = 0;
    for (int tail = 0; tail < length; ++tail) {
      for (int head = tail; head < length; ++head) {
        int r = inputs[tail] - inputs[head];
        r = ((r < 0) ? -r : r);
        if (r > max) max = r;
      }
    }

    System.out.println(max);
  }

} import java.io.InputStreamReader; InputStreamReader java.io import java.io.Reader; Reader java.io import java.util.Arrays; Arrays java.util public final class Main {

  private Main() {}

  public static int readCount(Reader reader) throws Exception {
    char[] buffer = new char[3];
    int bIndex = 0;

    for (;;) {
      int read = reader.read();
      if (read == '\r' || read == ' ') continue;
      if (read == '\n') return Integer.parseInt(String.valueOf(buffer, 0, bIndex));
      buffer[bIndex++] = (char) read;
    }
  }

  private static int[] parse(int count, Reader reader) throws Exception {
    char[] buffer = new char[10];
    int bIndex = 0;

    int[] result = new int[count];
    int rIndex = 0;

    for (;;) {
      int read = reader.read();
      if (read == '\r') continue;
      if (read == -1)
        return Arrays.copyOf(result, rIndex);

      char c = (char) read;
      if (c == '\n' || c == ' ') {
        if (bIndex != 0) {
          result[rIndex++] = Integer.parseInt(String.valueOf(buffer, 0, bIndex));
          bIndex = 0;
        }
        if (c == '\n') { return Arrays.copyOf(result, rIndex); }
        continue;
      }
      buffer[bIndex++] = c;
    }
  }

  public static void main(String[] args) throws Exception {
    final Reader reader = new InputStreamReader(System.in);

    final int length = readCount(reader);
    final int[] inputs = parse(length, reader);

    int max = 0;
    for (int tail = 0; tail < length; ++tail) {
      for (int head = tail; head < length; ++head) {
        int r = inputs[tail] - inputs[head];
        r = ((r < 0) ? -r : r);
        if (r > max) max = r;
      }
    }

    System.out.println(max);
  }

} Main private Main() {} Main {} public static int readCount(Reader reader) throws Exception {
    char[] buffer = new char[3];
    int bIndex = 0;

    for (;;) {
      int read = reader.read();
      if (read == '\r' || read == ' ') continue;
      if (read == '\n') return Integer.parseInt(String.valueOf(buffer, 0, bIndex));
      buffer[bIndex++] = (char) read;
    }
  } readCount {
    char[] buffer = new char[3];
    int bIndex = 0;

    for (;;) {
      int read = reader.read();
      if (read == '\r' || read == ' ') continue;
      if (read == '\n') return Integer.parseInt(String.valueOf(buffer, 0, bIndex));
      buffer[bIndex++] = (char) read;
    }
  } char[] buffer = new char[3]; buffer new char[3] 3 int bIndex = 0; bIndex 0 for (;;) {
      int read = reader.read();
      if (read == '\r' || read == ' ') continue;
      if (read == '\n') return Integer.parseInt(String.valueOf(buffer, 0, bIndex));
      buffer[bIndex++] = (char) read;
    } ; {
      int read = reader.read();
      if (read == '\r' || read == ' ') continue;
      if (read == '\n') return Integer.parseInt(String.valueOf(buffer, 0, bIndex));
      buffer[bIndex++] = (char) read;
    } {
      int read = reader.read();
      if (read == '\r' || read == ' ') continue;
      if (read == '\n') return Integer.parseInt(String.valueOf(buffer, 0, bIndex));
      buffer[bIndex++] = (char) read;
    } int read = reader.read(); read reader.read() reader.read reader if (read == '\r' || read == ' ') continue; read == '\r' || read == ' ' read == '\r' read '\r' read == ' ' read ' ' continue; if (read == '\n') return Integer.parseInt(String.valueOf(buffer, 0, bIndex)); read == '\n' read '\n' return Integer.parseInt(String.valueOf(buffer, 0, bIndex)); Integer.parseInt(String.valueOf(buffer, 0, bIndex)) Integer.parseInt Integer String.valueOf(buffer, 0, bIndex) String.valueOf String buffer 0 bIndex buffer[bIndex++] = (char) read buffer[bIndex++] buffer bIndex++ bIndex (char) read Reader reader reader private static int[] parse(int count, Reader reader) throws Exception {
    char[] buffer = new char[10];
    int bIndex = 0;

    int[] result = new int[count];
    int rIndex = 0;

    for (;;) {
      int read = reader.read();
      if (read == '\r') continue;
      if (read == -1)
        return Arrays.copyOf(result, rIndex);

      char c = (char) read;
      if (c == '\n' || c == ' ') {
        if (bIndex != 0) {
          result[rIndex++] = Integer.parseInt(String.valueOf(buffer, 0, bIndex));
          bIndex = 0;
        }
        if (c == '\n') { return Arrays.copyOf(result, rIndex); }
        continue;
      }
      buffer[bIndex++] = c;
    }
  } parse {
    char[] buffer = new char[10];
    int bIndex = 0;

    int[] result = new int[count];
    int rIndex = 0;

    for (;;) {
      int read = reader.read();
      if (read == '\r') continue;
      if (read == -1)
        return Arrays.copyOf(result, rIndex);

      char c = (char) read;
      if (c == '\n' || c == ' ') {
        if (bIndex != 0) {
          result[rIndex++] = Integer.parseInt(String.valueOf(buffer, 0, bIndex));
          bIndex = 0;
        }
        if (c == '\n') { return Arrays.copyOf(result, rIndex); }
        continue;
      }
      buffer[bIndex++] = c;
    }
  } char[] buffer = new char[10]; buffer new char[10] 10 int bIndex = 0; bIndex 0 int[] result = new int[count]; result new int[count] count int rIndex = 0; rIndex 0 for (;;) {
      int read = reader.read();
      if (read == '\r') continue;
      if (read == -1)
        return Arrays.copyOf(result, rIndex);

      char c = (char) read;
      if (c == '\n' || c == ' ') {
        if (bIndex != 0) {
          result[rIndex++] = Integer.parseInt(String.valueOf(buffer, 0, bIndex));
          bIndex = 0;
        }
        if (c == '\n') { return Arrays.copyOf(result, rIndex); }
        continue;
      }
      buffer[bIndex++] = c;
    } ; {
      int read = reader.read();
      if (read == '\r') continue;
      if (read == -1)
        return Arrays.copyOf(result, rIndex);

      char c = (char) read;
      if (c == '\n' || c == ' ') {
        if (bIndex != 0) {
          result[rIndex++] = Integer.parseInt(String.valueOf(buffer, 0, bIndex));
          bIndex = 0;
        }
        if (c == '\n') { return Arrays.copyOf(result, rIndex); }
        continue;
      }
      buffer[bIndex++] = c;
    } {
      int read = reader.read();
      if (read == '\r') continue;
      if (read == -1)
        return Arrays.copyOf(result, rIndex);

      char c = (char) read;
      if (c == '\n' || c == ' ') {
        if (bIndex != 0) {
          result[rIndex++] = Integer.parseInt(String.valueOf(buffer, 0, bIndex));
          bIndex = 0;
        }
        if (c == '\n') { return Arrays.copyOf(result, rIndex); }
        continue;
      }
      buffer[bIndex++] = c;
    } int read = reader.read(); read reader.read() reader.read reader if (read == '\r') continue; read == '\r' read '\r' continue; if (read == -1)
        return Arrays.copyOf(result, rIndex); read == -1 read -1 1 return Arrays.copyOf(result, rIndex); Arrays.copyOf(result, rIndex) Arrays.copyOf Arrays result rIndex char c = (char) read; c (char) read if (c == '\n' || c == ' ') {
        if (bIndex != 0) {
          result[rIndex++] = Integer.parseInt(String.valueOf(buffer, 0, bIndex));
          bIndex = 0;
        }
        if (c == '\n') { return Arrays.copyOf(result, rIndex); }
        continue;
      } c == '\n' || c == ' ' c == '\n' c '\n' c == ' ' c ' ' {
        if (bIndex != 0) {
          result[rIndex++] = Integer.parseInt(String.valueOf(buffer, 0, bIndex));
          bIndex = 0;
        }
        if (c == '\n') { return Arrays.copyOf(result, rIndex); }
        continue;
      } if (bIndex != 0) {
          result[rIndex++] = Integer.parseInt(String.valueOf(buffer, 0, bIndex));
          bIndex = 0;
        } bIndex != 0 bIndex 0 {
          result[rIndex++] = Integer.parseInt(String.valueOf(buffer, 0, bIndex));
          bIndex = 0;
        } result[rIndex++] = Integer.parseInt(String.valueOf(buffer, 0, bIndex)) result[rIndex++] result rIndex++ rIndex Integer.parseInt(String.valueOf(buffer, 0, bIndex)) Integer.parseInt Integer String.valueOf(buffer, 0, bIndex) String.valueOf String buffer 0 bIndex bIndex = 0 bIndex 0 if (c == '\n') { return Arrays.copyOf(result, rIndex); } c == '\n' c '\n' { return Arrays.copyOf(result, rIndex); } return Arrays.copyOf(result, rIndex); Arrays.copyOf(result, rIndex) Arrays.copyOf Arrays result rIndex continue; buffer[bIndex++] = c buffer[bIndex++] buffer bIndex++ bIndex c int count count Reader reader reader public static void main(String[] args) throws Exception {
    final Reader reader = new InputStreamReader(System.in);

    final int length = readCount(reader);
    final int[] inputs = parse(length, reader);

    int max = 0;
    for (int tail = 0; tail < length; ++tail) {
      for (int head = tail; head < length; ++head) {
        int r = inputs[tail] - inputs[head];
        r = ((r < 0) ? -r : r);
        if (r > max) max = r;
      }
    }

    System.out.println(max);
  } main {
    final Reader reader = new InputStreamReader(System.in);

    final int length = readCount(reader);
    final int[] inputs = parse(length, reader);

    int max = 0;
    for (int tail = 0; tail < length; ++tail) {
      for (int head = tail; head < length; ++head) {
        int r = inputs[tail] - inputs[head];
        r = ((r < 0) ? -r : r);
        if (r > max) max = r;
      }
    }

    System.out.println(max);
  } final Reader reader = new InputStreamReader(System.in); reader new InputStreamReader(System.in) final int length = readCount(reader); length readCount(reader) readCount reader final int[] inputs = parse(length, reader); inputs parse(length, reader) parse length reader int max = 0; max 0 for (int tail = 0; tail < length; ++tail) {
      for (int head = tail; head < length; ++head) {
        int r = inputs[tail] - inputs[head];
        r = ((r < 0) ? -r : r);
        if (r > max) max = r;
      }
    } int tail = 0; int tail = 0; tail 0 tail < length tail length ++tail ++tail tail {
      for (int head = tail; head < length; ++head) {
        int r = inputs[tail] - inputs[head];
        r = ((r < 0) ? -r : r);
        if (r > max) max = r;
      }
    } {
      for (int head = tail; head < length; ++head) {
        int r = inputs[tail] - inputs[head];
        r = ((r < 0) ? -r : r);
        if (r > max) max = r;
      }
    } for (int head = tail; head < length; ++head) {
        int r = inputs[tail] - inputs[head];
        r = ((r < 0) ? -r : r);
        if (r > max) max = r;
      } int head = tail; int head = tail; head tail head < length head length ++head ++head head {
        int r = inputs[tail] - inputs[head];
        r = ((r < 0) ? -r : r);
        if (r > max) max = r;
      } {
        int r = inputs[tail] - inputs[head];
        r = ((r < 0) ? -r : r);
        if (r > max) max = r;
      } int r = inputs[tail] - inputs[head]; r inputs[tail] - inputs[head] inputs[tail] inputs tail inputs[head] inputs head r = ((r < 0) ? -r : r) r ((r < 0) ? -r : r) (r < 0) r 0 -r r r if (r > max) max = r; r > max r max max = r max r System.out.println(max) System.out.println System.out System System.out max String[] args args public final class Main {

  private Main() {}

  public static int readCount(Reader reader) throws Exception {
    char[] buffer = new char[3];
    int bIndex = 0;

    for (;;) {
      int read = reader.read();
      if (read == '\r' || read == ' ') continue;
      if (read == '\n') return Integer.parseInt(String.valueOf(buffer, 0, bIndex));
      buffer[bIndex++] = (char) read;
    }
  }

  private static int[] parse(int count, Reader reader) throws Exception {
    char[] buffer = new char[10];
    int bIndex = 0;

    int[] result = new int[count];
    int rIndex = 0;

    for (;;) {
      int read = reader.read();
      if (read == '\r') continue;
      if (read == -1)
        return Arrays.copyOf(result, rIndex);

      char c = (char) read;
      if (c == '\n' || c == ' ') {
        if (bIndex != 0) {
          result[rIndex++] = Integer.parseInt(String.valueOf(buffer, 0, bIndex));
          bIndex = 0;
        }
        if (c == '\n') { return Arrays.copyOf(result, rIndex); }
        continue;
      }
      buffer[bIndex++] = c;
    }
  }

  public static void main(String[] args) throws Exception {
    final Reader reader = new InputStreamReader(System.in);

    final int length = readCount(reader);
    final int[] inputs = parse(length, reader);

    int max = 0;
    for (int tail = 0; tail < length; ++tail) {
      for (int head = tail; head < length; ++head) {
        int r = inputs[tail] - inputs[head];
        r = ((r < 0) ? -r : r);
        if (r > max) max = r;
      }
    }

    System.out.println(max);
  }

} public final class Main {

  private Main() {}

  public static int readCount(Reader reader) throws Exception {
    char[] buffer = new char[3];
    int bIndex = 0;

    for (;;) {
      int read = reader.read();
      if (read == '\r' || read == ' ') continue;
      if (read == '\n') return Integer.parseInt(String.valueOf(buffer, 0, bIndex));
      buffer[bIndex++] = (char) read;
    }
  }

  private static int[] parse(int count, Reader reader) throws Exception {
    char[] buffer = new char[10];
    int bIndex = 0;

    int[] result = new int[count];
    int rIndex = 0;

    for (;;) {
      int read = reader.read();
      if (read == '\r') continue;
      if (read == -1)
        return Arrays.copyOf(result, rIndex);

      char c = (char) read;
      if (c == '\n' || c == ' ') {
        if (bIndex != 0) {
          result[rIndex++] = Integer.parseInt(String.valueOf(buffer, 0, bIndex));
          bIndex = 0;
        }
        if (c == '\n') { return Arrays.copyOf(result, rIndex); }
        continue;
      }
      buffer[bIndex++] = c;
    }
  }

  public static void main(String[] args) throws Exception {
    final Reader reader = new InputStreamReader(System.in);

    final int length = readCount(reader);
    final int[] inputs = parse(length, reader);

    int max = 0;
    for (int tail = 0; tail < length; ++tail) {
      for (int head = tail; head < length; ++head) {
        int r = inputs[tail] - inputs[head];
        r = ((r < 0) ? -r : r);
        if (r > max) max = r;
      }
    }

    System.out.println(max);
  }

} Main

import java.io.InputStreamReader;
import java.io.Reader;
import java.util.Arrays;

public final class Main {

  private Main() {}

  public static int readCount(Reader reader) throws Exception {
    char[] buffer = new char[3];
    int bIndex = 0;

    for (;;) {
      int read = reader.read();
      if (read == '\r' || read == ' ') continue;
      if (read == '\n') return Integer.parseInt(String.valueOf(buffer, 0, bIndex));
      buffer[bIndex++] = (char) read;
    }
  }

  private static int[] parse(int count, Reader reader) throws Exception {
    char[] buffer = new char[10];
    int bIndex = 0;

    int[] result = new int[count];
    int rIndex = 0;

    for (;;) {
      int read = reader.read();
      if (read == '\r') continue;
      if (read == -1)
        return Arrays.copyOf(result, rIndex);

      char c = (char) read;
      if (c == '\n' || c == ' ') {
        if (bIndex != 0) {
          result[rIndex++] = Integer.parseInt(String.valueOf(buffer, 0, bIndex));
          bIndex = 0;
        }
        if (c == '\n') { return Arrays.copyOf(result, rIndex); }
        continue;
      }
      buffer[bIndex++] = c;
    }
  }

  public static void main(String[] args) throws Exception {
    final Reader reader = new InputStreamReader(System.in);

    final int length = readCount(reader);
    final int[] inputs = parse(length, reader);

    int max = 0;
    for (int tail = 0; tail < length; ++tail) {
      for (int head = tail; head < length; ++head) {
        int r = inputs[tail] - inputs[head];
        r = ((r < 0) ? -r : r);
        if (r > max) max = r;
      }
    }

    System.out.println(max);
  }

}
