using System;

namespace zad4
{
    public class zadatak
    {
        public static void Main()
        {
            int n=int.Parse(Console.ReadLine());
            int x = 0, s = 0, n1;
            n1 = n; 
            while (n > 0)
            {
                x = n % 10;
                s = s + x;
                n = n / 10;
            } 
            if (n1 % s == 0)
                Console.WriteLine("0");
            else
                Console.WriteLine("1");
        }
    }


}