pin 22 to 45 on Mega2560 not working as digital inputs

Dear All
thank you in advance for the help. I am seeing a strange behaviour. My Arduino 2560 (i have 2 of them) are not allowing me to take inputs from pin 22-45. I want to use them as digital pins and simply use digitalRead to get the signal. I am however not getting anything or getting a constant one.
Interestingly if I simply configure them as digital output I am able to light up a LED with the pins.
If it helps I am using a capacitive switch as input which has 5 V.
Also when I change the pin to say 2 the code works!
any help is appreciated

Here is the code

int b1=0;

void setup() {
// put your setup code here, to run once:
pinMode(22, INPUT); //pod1_button1

}

void loop() {
// put your main code here, to run repeatedly:
Serial.println(digitalRead(22));
}

thanks
Kanav

Disconnect whatever is connected to pin 22, enable the pull-up, and use a jumper wire to connect to ground.
Run your sketch.
Disconnect jumper wire.
Rinse and repeat.
Report back.

https://www.arduino.cc/en/Tutorial/DigitalPins - hope this helps