// author : anphung
#include<bits/stdc++.h>
using namespace std;
#define file "SOCHAN"
#define int64 long long
#define f0(i,a,b) for(int (i) = (a); (i) <= (b); ++i)
#define TIME (1.0*clock()/CLOCKS_PER_SEC)
int64 n;
int64 s(int64 n){
int64 sum = 0;
while(n){
sum += n%10;
n/=10;
}
return sum;
}
void trau(){
int64 cnt = 0;
f0(i,1,n){
if(s(i)%2==0){
cnt++;
}
cout<<i<<" "<<cnt<<'\n';
}
cout<<cnt;
}
void sub(){
if(s(n)%2==0){
if(n%2==0){
cout<<n/2;
}else if(n%2!=0){
cout<<n/2;
}
}else if(s(n)%2!=0){
if(n%2==0){
cout<<n/2-1;
}else if(n%2!=0){
cout<<n/2;
}
}
}
int32_t main(){
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
freopen(file".inp","r",stdin);
freopen(file".out","w",stdout);
cin>>n;
sub();
//cerr<<"\ntime elapsed: "<<TIME <<"s.\n";
}
Ly8gYXV0aG9yIDogYW5waHVuZwojaW5jbHVkZTxiaXRzL3N0ZGMrKy5oPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwojZGVmaW5lIGZpbGUgIlNPQ0hBTiIKI2RlZmluZSBpbnQ2NCBsb25nIGxvbmcKI2RlZmluZSBmMChpLGEsYikgZm9yKGludCAoaSkgPSAoYSk7IChpKSA8PSAoYik7ICsraSkKI2RlZmluZSBUSU1FICgxLjAqY2xvY2soKS9DTE9DS1NfUEVSX1NFQykKCmludDY0IG47CgppbnQ2NCBzKGludDY0IG4pewogICAgaW50NjQgc3VtID0gMDsKICAgIHdoaWxlKG4pewogICAgICAgIHN1bSArPSBuJTEwOwogICAgICAgIG4vPTEwOwogICAgfQogICAgcmV0dXJuIHN1bTsKfQoKdm9pZCB0cmF1KCl7CiAgICBpbnQ2NCBjbnQgPSAwOwogICAgZjAoaSwxLG4pewogICAgICAgIGlmKHMoaSklMj09MCl7CiAgICAgICAgICAgIGNudCsrOwogICAgICAgIH0KICAgICAgICBjb3V0PDxpPDwiICI8PGNudDw8J1xuJzsKICAgIH0KICAgIGNvdXQ8PGNudDsKfQoKdm9pZCBzdWIoKXsKICAgIGlmKHMobiklMj09MCl7CiAgICAgICAgaWYobiUyPT0wKXsKICAgICAgICAgICAgY291dDw8bi8yOwogICAgICAgIH1lbHNlIGlmKG4lMiE9MCl7CiAgICAgICAgICAgIGNvdXQ8PG4vMjsKICAgICAgICB9CiAgICB9ZWxzZSBpZihzKG4pJTIhPTApewogICAgICAgIGlmKG4lMj09MCl7CiAgICAgICAgICAgIGNvdXQ8PG4vMi0xOwogICAgICAgIH1lbHNlIGlmKG4lMiE9MCl7CiAgICAgICAgICAgIGNvdXQ8PG4vMjsKICAgICAgICB9CiAgICB9Cn0KCmludDMyX3QgbWFpbigpewogICAgaW9zX2Jhc2U6OnN5bmNfd2l0aF9zdGRpbygwKTtjaW4udGllKDApO2NvdXQudGllKDApOwogICAgZnJlb3BlbihmaWxlIi5pbnAiLCJyIixzdGRpbik7CiAgICBmcmVvcGVuKGZpbGUiLm91dCIsInciLHN0ZG91dCk7CgogICAgY2luPj5uOwogICAgc3ViKCk7CgogICAgLy9jZXJyPDwiXG50aW1lIGVsYXBzZWQ6ICI8PFRJTUUgPDwicy5cbiI7Cn0K