int nine = a1, b1, c1, d1, f1, g1;
No that won't do what you want. technically a variable can only hold 1 value. a variable is a location in memory and the variable is the address of that location.
when you say int nine = 10; you declare an int, 2 bytes somewhere in memory, and you then write the binary representation of 10 into those 2 bytes.
what you need is an array (read the doc)
int nine[] = {a1, b1, c1, d1, f1, g1};
and if you need to find out how many pins are "attached" into that array it would be
int nbOfPinsForNine = (sizeof(nine) / sizeof(nine[0]));