Here are two facts about modern life that might at first seem contradictory. One, according to former surgeon general Vivek Murthy we're in the middle of a loneliness epidemic with as many as half of Americans telling pollsters they're seriously lonely. And two, thanks to our gadgets and our social media accounts, we're also more connected to more people than ever.

What's up with that? How can we be both simultaneously more connected and lonelier? A fascinating new study offers an intriguing answer. Apparently, when it comes to loneliness, it's not the quantity of friendships that matter, it's the quality.

How you can have 500 Facebook friends and still be totally lonely

We tend to think of loneliness as a single emotional state -- you either are lonely or you're not. But the Trinity College Dublin psychologist behind the study, recently published in Social Psychiatry and Psychiatric Epidemiology, had an idea that loneliness might be more complicated than it first appears. To test this theory, he polled 1,839 Americans to tease out the relationship between different flavors of loneliness and people's mental health.

First, he asked people how many connections they had. Did they see people a lot? Did they have lots of acquaintances and friends? Second, he asked them not about the number of their connections, but about their quality. Did respondents feel seen and understood by the people around them? Could really open up to people?

When the numbers were tallied a clear pattern emerged. Folks who were lucky enough to have both lots of connections and warm feelings of closeness to those connections were, unsurprisingly, the happiest of all. Those who had neither, equally unsurprisingly, were the most miserable. But if you had to choose between having a lots of loose connections or a few close friends, there was a clear winner.

Not seeing and talking to many people is apparently a lot easier to bear than not having any truly close friends. "In other words, quality of relationships appears more important to mental health than the sheer number of them," the British Psychological Society Research Digest blog says, summing up the findings.

Or to put it yet another way, not going out every night of the week (or any night of the week) will bum you out a little. Not having anyone to have a real heart to heart with will bum you out a ton. And the resulting loneliness, science shows, can have dire effects not just on our mental but on our physical health as well.

Studies agree on the importance of besties

It should also be noted that this is far from the first study to attest to mental health-boosting power of a couple of true besties. Other research focused on kids shows those who have a few close friends grow up to be happier and healthier than those with big circles but no truly close peer relationships.

Meanwhile, some networking experts have also made the case that, even on a professional level, a handful of truly close ties will get you further than a giant Rolodex full of loose connections (though not all science points in the same direction on this).

This latest study makes one thing clear at least -- if you're looking to beat loneliness and avoid the terrible effects it han have on your body and state of mind, than worry less about how many people you know and instead focus on how well you know them. One person who truly gets you is worth more than a hundred casual online "friends."