import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.PrintWriter;
import java.util.Scanner;
public class Main {
static final class Solver {
static final int SIZE = 200005;
double[] a = new double[SIZE];
static int n;
public final void solve(InputReader in, PrintWriter out) {
while (in.hasNext()) {
n = in.nextInt();
for (int i = 0; i < n; ++i) {
a[i] = in.nextDouble();
}
// out.printf("%.8f\n", force());
out.printf("%.8f\n", ac());
}
}
double ac() {
double tmp, l, r, res = 0;
int index;
for (int i = 0; i < n; ++i) {
tmp = (a[i] >= 180) ? (a[i] - 180) : (a[i] + 180);
index = upperBound(0, n - 1, tmp);
res = Math.max(res, dis(a[(index - 1 + n) % n], a[i]));
res = Math.max(res, dis(a[index % n], a[i]));
}
return res;
}
int upperBound(int l, int r, double v) {
while (l < r) {
int m = l + (r - l) / 2;
if (a[m] <= v)
l = m + 1;
else if (a[m] > v)
r = m;
}
return l;
}
double force() {
double res = 0.0;
for (int i = 0; i < n; ++i) {
for (int j = 0; j < n; ++j) {
res = Math.max(res, dis(a[i], a[j]));
}
}
return res;
}
double dis(double d1, double d2) {
double res = (d1 > d2) ? (d1 - d2) : (d2 - d1);
if (res > 180) {
res = 360 - res;
}
return res;
}
}
public static void main(String[] args) {
PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out, 32768));
Solver solver = new Solver();
solver.solve(new InputReader(), out);
out.close();
}
static class InputReader {
private Scanner reader = new Scanner(new BufferedInputStream(System.in, 32768));
public int nextInt() {
try {
return Integer.parseInt(reader.nextLine());
} catch (NumberFormatException e) {
e.printStackTrace();
}
return 0;
}
public double nextDouble() {
try {
return Double.parseDouble(reader.nextLine());
} catch (NumberFormatException e) {
e.printStackTrace();
}
return 0;
}
public boolean hasNext() {
return reader.hasNext();
}
}
}