unsigned int count=0, i;
void setup() {
  DDRC= 0x00;
  DDRB= 0x00;
  DDRD= 0xFF;
}

void loop() {
  PINC= 0x00;
  for(i=0; i<3; i++)
  {
    if((PINC & 0x01)==1)
    count++;
    PINC= PINC>>1;
  }
  if(count%2==0)
  PORTB='E';
  else
  PORTB= 'O';
  if(PORTB=='E')
  PORTD |= 1<<7;
  else
  PORTD &= ~(1<<7);
}