#include <bits/stdc++.h>
int main() {
  int a;
  std::cin >> a;
  if (a == 000) {
    std::cout << 0 << std::endl;
  } else {
    if (a == 111) {
      std::cout << 3 << std::endl;
    } else {
      if (a == 100 | a == 010 | a == 001) {
        std::cout << 1 << std::endl;
      } else {
        std::cout << 2 << std::endl;
      }
    }
  }
}
