#include<bits/stdc++.h>
using namespace std;

typedef long long LL;
typedef pair<int, int> PII;
const int N = 510 + 10;
#define gcd __gcd
const int mod = 200;
const int inf = 0x3f3f3f3f;
#define x first
#define y second

int a[N];

void solve() {
	int n;
	scanf("%d", &n);
	printf("%d\n", n / 100 + (n % 100 != 0));
}

int main() {
	// freopen("in.txt", "r", stdin);
	solve();
	return 0;
}
// Problem C

#include <stdio.h>
#include <iostream>
#include <vector>
#include <string.h>
#include <cassert>
#include <algorithm>
#include <set>
#include <map>
#include <math.h>
#include <queue>
#include <stack>

#define MAXN 1000
#define pb push_back
#define mp make_pair

using namespace std;

typedef long long int ll;
typedef pair<int, int> ii;

int c[3];

int main() {
  long long n;
  cin >> n;
  
  int ncifre = 0;
  
  while (n!=0) {
    c[(n%10)%3]++;
    n = n/10;
    ncifre++;
  }
  
  if ((c[1] + 2*c[2] )%3 == 0)
    cout << "0\n";
  else if ((c[1] + 2*c[2]) % 3 == 1) {
    if (c[1] >= 1 && ncifre >= 2) cout << "1\n";
    else if (c[2] >= 2 && ncifre >= 3) cout << "2\n";
    else cout << "-1\n";
  }
  else {
    if (c[2] >= 1 && ncifre >= 2) cout << "1\n";
    else if (c[1] >= 2 && ncifre >= 3) cout << "2\n";
    else cout << "-1\n";
  }
  
  
  
  return 0;
}
