1 /*
2 求阶乘N! 质数分解后2的幂是多少
3
4 快速的解法是 N/2 + N/4 + ....
5
6 数论好题,特别对于对这个不是很清楚的时候,收益很大
7 */
8
9 // include file
10 #include <cstdio>
11 #include <cstdlib>
12 #include <cstring>
13 #include <cmath>
14 #include <cctype>
15 #include <ctime>
16
17 #include <iostream>
18 #include <sstream>
19 #include <fstream>
20 #include <iomanip>
21 #include <bitset>
22 #include <strstream>
23
24 #include <algorithm>
25 #include <string>
26 #include <vector>
27 #include <queue>
28 #include <set>
29 #include <list>
30 #include <functional>
31
32 using namespace std;
33
34 // typedef
35 typedef long long LL;
36 typedef unsigned long long ULL;
37 typedef __int64 Bint;
38
39 //
40 #define read freopen("in.txt","r",stdin)
41 #define write freopen("out.txt","w",stdout)
42 #define FORi(a,b,c) for(int i=(a);i<(b);i+=c)
43 #define FORj(a,b,c) for(int j=(a);j<(b);j+=c)
44 #define FORk(a,b,c) for(int k=(a);k<(b);k+=c)
45 #define FORp(a,b,c) for(int p=(a);p<(b);p+=c)
46 #define FORii(a,b,c) for(int ii=(a);ii<(b);ii+=c)
47 #define FORjj(a,b,c) for(int jj=(a);jj<(b);jj+=c)
48 #define FORkk(a,b,c) for(int kk=(a);kk<(b);kk+=c)
49
50 #define FF(i,a) for(int i=0;i<(a);i+++)
51 #define FFD(i,a) for(int i=(a)-1;i>=0;i--)
52 #define Z(a) (a<<1)
53 #define Y(a) (a>>1)
54
55 const double eps = 1e-6;
56 const double INFf = 1e10;
57 const int INFi = 1000000000;
58 const double Pi = acos(-1.0);
59
60 template<class T> inline T sqr(T a){return a*a;}
61 template<class T> inline T TMAX(T x,T y)
62 {
63 if(x>y) return x;
64 return y;
65 }
66 template<class T> inline T TMIN(T x,T y)
67 {
68 if(x<y) return x;
69 return y;
70 }
71 template<class T> inline void SWAP(T &x,T &y)
72 {
73 T t = x;
74 x = y;
75 y = t;
76 }
77 template<class T> inline T MMAX(T x,T y,T z)
78 {
79 return TMAX(TMAX(x,y),z);
80 }
81
82
83 // code begin
84 int N,K;
85 int cal(int n)
86 {
87 Bint x=2;
88 int ans=0;
89 while(x<=n)
90 {
91 ans += n/x;
92 x = Z(x);
93 }
94 return ans;
95 }
96
97 int main()
98 {
99 read;
100 write;
101 while(scanf("%d %d",&N,&K)!=-1)
102 {
103 if(K==0||K==N)
104 {
105 puts("1");
106 }
107 else if(K==1||K==N-1)
108 {
109 (N&1)?puts("1"):puts("0");
110 }
111 else
112 {
113 (cal(N)==cal(K)+cal(N-K))?puts("1"):puts("0");
114 }
115 }
116 return 0;
117 }