GOFFSTOWN, N.H. -- Of all the traits that are required for success in American politics, the most important may be tenacity. I was reminded of that last weekend as the dozen Democratic and Republican presidential candidates came together here on successive nights at St. Anselm's College for the League of Women Voters debates.

By my rough calculation, these 12 men had at least 50 memorable primary and general-election defeats on their records, stretching back 20 years or more in some cases and including, for most, setbacks in the current campaign. Indeed, the striking fact about them is that their strength and prospects seem inversely related to the number of election scars they carry. It is almost as if the voters value them for wounds that have been inflicted on them in the past.

For example, Michael Dukakis, the favorite to win the Democratic primary here, was administered a memorable rebuke by the Democratic voters of next-door Massachusetts when he tried for renomination at the end of his first term as governor in 1978. Dukakis sat out for four years, then fought his way back into office.

Vice President George Bush and Sen. Robert Dole of Kansas, the front-runners on the Republican side, were humbled by New Hampshire voters the last time they appeared on the presidential primary ballot here in 1980. Thoroughly beaten by Ronald Reagan that year, both came back to try again in 1988.

By contrast, the three trailing Republican candidates, Rep. Jack Kemp. former Delaware governor Pierre S. (Pete) du Pont IV and former television evangelist Marion (Pat) Robertson, had never lost an election until they were beaten by Dole in Iowa on Feb. 8. Kemp and du Pont had never run in a constituency larger than a congressional district, and Robertson had never run at all. Risk-free careers cannot, by definition, prove tenacity.

On the Democratic side, former senator Gary Hart of Colorado, Walter Mondale's main punching bag in the 1984 primaries, was leading the national polls until he withdrew from the race after a personal scandal last May. He was replaced by Jesse Jackson, who lost even more primaries in 1984 than Hart did.

Those who had not tried and lost for major office before -- former governor Bruce Babbitt of Arizona, Sen. Albert Gore Jr. of Tennessee and Rep. Richard Gephardt of Missouri -- were far back in the national polls, though Gephardt won a narrow victory in Iowa over Sen. Paul Simon. Simon, whose mere presence in the race has confounded many skeptics, had an experience like Dukakis' 1978 loss. When he tried to move up from lieutenant governor to governor of Illinois more than a decade ago, he was upset in the Democratic primary. But he started over in the House.

What is it that draws voters in one year to candidates that they -- or their counterparts -- have roundly rejected in a previous campaign? It is a recognition that tenacity is a terribly useful quality in top leadership posts such as the White House. As Jackson said in Saturday night's debate, ''You have to have a tough mind and thick skin to run for president.''

Sometimes that tenacity can be excessive -- and dangerous. Richard Nixon lost back-to-back elections, for president in 1960 and for governor of California in 1962, but was unwilling to take no for an answer from the voters. He dedicated the next six years of his life to gaining another chance at the brass ring, and when he won the White House in 1968, the dream had been too long deferred. Unable to accept the criticism and opposition that went with the job, he became increasingly isolated and eventually sanctioned the White House secret-police operation that forced him from office.

But for the most part, the voters' instinct to credit tenacity as a political trait is a healthy one. Bob Dole became a better senator after losing as the Republican vice-presidential candidate in 1976 and especially after his humiliating defeat in the 1980 presidential primaries. Dukakis was a better governor when he came back in 1982 than he had been in the first term in the state House.

It is not just a matter of improved skills. It is even more a matter of changed outlooks. Experience is a great teacher, and the experience of being denied something one greatly covets -- as politicians covet an office -- is one of the most widely shared conditions of life in a society such as ours.

Better a president who has come back from the pain and humiliation of defeat than one who has never known -- or had to overcome -- those feelings.

That's an important lesson to remember now. The New Hampshire primary marks the end of the line for several presidential candidates each election year. But it need not mark the end of their careers. Those who are winnowed out one year can -- and often do -- come back as winners another year. All it takes is tenacity.

"Better a president who has come back from the pain and humiliation of defeat than one who has never known . . . those feelings."