int pin = 7;
int pin2 = 8;
If you are counting things, do you count "a sock, 2 socks, 3 socks, ..." or do you count "1 sock, 2 socks, 3 socks, ..."?
If you number one variable, you should number the other one, too.
If you declare one pin as input, you should declare the other as input, too.
duration1 = pulseIn(pin, HIGH);
duration1 and duration2 are not declared/typed anywhere.
if (duration1 == 2000)
I don't know what you are timing, but it is unlikely to take EXACTLY 2000 microseconds, whatever it is.
You'll be disappointed with the results of setting an INPUT pin HIGH. Pins are INPUT by default. If you want to write to a pin, you should set it as an OUTPUT pin.