#define set1(r,b) r|=(1<<b)
#define set0(r,b) r&=~(1<<b)
#define test(r,b) (r&(1<<b))
int cislo = 0;

void setup() {
Serial.begin(9600);
set0(DDRD,2);
set1(PORTD,2);
set0(DDRB,3);
set1(PORTB,3);
set0(DDRC,4);
set1(PORTC,4);
set1(SREG,7);

set1(PCICR,PCIE0);
set1(PCMSK0,PCINT3);

set1(PCICR,PCIE2);
set1(PCMSK2,PCINT18);

set1(PCICR,PCIE1);
set1(PCMSK1,PCINT12);
}

void loop() {
  // put your main code here, to run repeatedly:

}

ISR(PCINT0_vect)
{
  if(test(PINB,3)==0){
    cislo--;
    Serial.println(cislo);
  }
}

ISR(PCINT1_vect)
{
  if(test(PINC,4)==0){
    cislo++;
    Serial.println(cislo);
  }
}

ISR(PCINT2_vect)
{
  if(test(PIND,2)==0){
    cislo=0;
    Serial.println(cislo);
  }
}