Check logged-in status with 'p4 login -s' instead of counting tickets.