public static void main(String[] args) {
Scanner in = new Scanner(new BufferedInputStream(System.in));
int[] num = new int[20];
int a, i;
for (i = 0;; i++) {
a = in.nextInt();
if (a == 0)
break;
num[i] = a;
}
for (int j = 0; j < i; j++) {
for (int k = 0; k < i - 1; k++) {
if (num[k] < num[k + 1]) {
int temp = num[k];
num[k] = num[k + 1];
num[k + 1] = temp;
}
}
}
System.out.println(num[1]);
}
}