count ids code