theres only selected, maya does not cre where the selection was done! even if you just select in outliner maya still selects them:
at easiest its this:
CODE
print (size(ls -sl
));
however most basic users dontrelay thinkof groups as one object. they jut doe4nt think of groups or empty trasforms PERIOD, while in alla ctuality the abobve reflects more on the truuth of things some users woudl prefer the following instead.
CODE
print (size(ls -sl -dag -shapes
));
wch one to choose depends on your definition of object! and whats selected 