Finder → Go → Utilities → Script Editor:
tell application "Safari" count of tabs of front window end tell
tell application "Safari" count every tab of every window end tell
Don't worry, if any AppleScript has a bug and doesn't run, then it won't affect Safari. It simply gives an error in the Script Editor.