# include <cstdio>

int N;
int main (void) {
    scanf ("%d", &N);
    printf ("%d", N * N % 3 != 0);
}