Losing count during الطواف is extremely common, especially given the intense crowds, emotional state, and spiritual focus of the experience. The أُسس ruling among the majority of scholars (Hanafi, Maliki, Shafi'i, and Hanbali) is to take the lower number you are reasonably certain of and continue from there. This is based on the general Islamic principle that certainty is not overridden by doubt.
For example, if you are uncertain whether you have completed 5 or 6 circuits, you should count it as 5 and perform 2 more circuits to reach 7. It is better to do an extra circuit than to risk completing fewer than the required 7. If someone accompanying you has been keeping count reliably, you may rely on their count.
To prevent losing count, use practical aids: a digital counter (tally counter or smartphone app like الإحرامOS), tasbih beads (move one bead after each circuit), finger counting (fold one finger per circuit), or ask a companion to track independently. Each circuit begins and ends at the الحجر الأسود (Hajar al-Aswad) corner — use this as your definitive marker. Some الحجاج also use the green light on the wall of the مسجد that marks the الحجر الأسود line as a reference point for each completed circuit.