'use strict'; const main = (input) => { const N = input.trim(); const num = Number(N); if (num % 3 === 0) { console.log(0); } else if (num % 3 === 2) { console.log(1); } else { console.log(2); } }; main(require('fs').readFileSync('/dev/stdin', 'utf8'));