package 第三周课后编程练习与学习任务;
import java.util.Arrays;
import java.util.Scanner;
import java.util.TreeSet;
public class zuoye4 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String str = sc.nextLine().toString();
int a[] = new int[str.length()];
for (int b = 0; b < str.length();b++) {
char c = str.charAt(b);
a[b] = (int) (c -'0');
}
int temp = 0;
for (int c = 0; c < str.length();c++) {
for (int d = 0; d < str.length();d++) {
if (a[c] >a[d]) {
temp =a[c];
a[c] =a[d];
a[d] =temp;
}
}
}
TreeSet<Integer> ts =new TreeSet<Integer>();
int b = 0;
for (int z = 0; z < a.length - 1;z++) {
b = a[z + 1] - a[z];
ts.add(b);
}
if (ts.size() == 1) {
System.out.println("1");
} else {
System.out.println("0");
}
}
}