#include <stdio.h>
typedef struct {
unsigned short reg;
} ConfigRegister;
int validate_config(ConfigRegister *cfg) {
unsigned short value = cfg->reg;
if(value == 0x0000) return 0; //Bit 0 is disabled
if(((value>>2) & 3) == 0x0003) return 0; //Invalid priority
if((value>>4)&0x0FFF != 0x0000) return 0; //Invalid reserved bits;
return 1;
}
int main() {
ConfigRegister cfg;
scanf("%hx", &cfg.reg);
int result = validate_config(&cfg);
printf("%d", result);
return 0;
}