#include <iostream>
using namespace std;
int x, a, b, c, nr;
int main()
{
cin >> x;
c = x % 10;
b = ( x / 10 ) % 10;
a = x / 100;
if ( a <= b && b <= c) {cout << b ; return 0;}
if ( a <= c && c <= b) {cout << c; return 0;}
if ( b <= a && a <= c) {cout << a; return 0;}
if ( b <= c && c <= a) {cout << c; return 0;}
if ( c <= a && a <= b) {cout << a; return 0;}
if ( c <= b && b <= a) {cout << b; return 0;}
}