How I Met Your Mother was one of the most popular sitcoms of the past two decades with an extremely loyal fan-base and a series that stretched for nine years and over two-hundred episodes. The keyword in that sentence is ‘sitcom’ because the entire point of the show was to make people laugh; ergo, not every character that audiences came to know and love was the shiniest penny on the subway (you win a $1.50 hot-dog if you understand the references).

While no members of the main cast are meant to be stupid or purposely dimwitted, such as Andy on Parks and Recreation or Jake from Two & a Half Men, it is evident throughout the series that some of our favorite Manhattan-dwellers are wiser than the others. Here’s our list of the main characters of How I Met Your Mother ranked by their level of intelligence.

Robin

We’ll say it once again just to be clear - none of the characters were purposely, or even noticeably, stupid. However, when it comes to Robin, intelligence was never exactly the trait that best describes her either. In the case of Robin’s stupidity, her character just seemed to be all over the place in terms of what she wanted out of life and it made the audience quite frustrated.

Robin would get Ted, a great guy who wanted a family and turn him down for her career, but then flip right around and go after Barney claiming that her love life was always more important to her than her love life. If that weren’t enough to make the case, Robin’s entire illustrious career was nothing more than reading a teleprompter. While journalism or hosting a morning show are both testing jobs, they are not exactly the biggest brain-drainers either.

Tracy

Unfortunately, Tracy gets the low rank on our list simply for the reason that we didn’t see enough of her to really get a grip on her level of intelligence. The audience was blessed with one brief season of the notorious mother that we’d heard so much about through the years, but even then it wasn’t enough to grasp who she truly was from an intellectual standpoint.

Tracy was funny, quirky, and all-around lovable, but fans never even learned what she did for a living. She stated that she wanted to save the world and was getting a degree in economics from Columbia University so she obviously can’t be an idiot, but it’s still not quite enough to go on. For all we know, Tracy could be the smartest of all the How I Met Your Mother characters, but sadly Ted took his sweet time telling the story so we only got a flashing glimpse of her possibilities.

Ted

He might not be a rocket scientist, but becoming an architect isn’t exactly the easiest career to pursue and Ted turned out to be incredibly successful at it by a very young age. As they even stated in the series, Ted is the youngest person to design a building over 70 stories (probably) and he added a building to the Manhattan city skyline, achieving his life-long dream by the age of 35.

How many other people can say they’ve achieved nearly everything that they’ve wanted to, career-wise, by the time they’ve hit their 35th birthday? Then again, maybe it’s because Ted had all that extra time to focus on his career since he didn’t have a wife or kids yet, but at least all of that was just a little way down the road for him.

Lily

Lily quickly became a fan-favorite of the show and her sneaky form of intelligence had a lot to do with it. While her job as a kindergarten teacher might not be the most challenging of professions from an intellectual standpoint, one of the best characteristics of Lily was the fact that she was like a ninja: Constantly sneaking around and manipulating the wills and actions of her friends in order to obtain an outcome most pleasing to her.

Lily was devious and cunning. She was so sneaky and sly about it that audiences took no time at all falling in love with her mind games. If Lily had been a real-life friend, her antics most likely wouldn’t have won her any favors, but thanks to the laugh-track constantly backing her up, fans had no problem at all with her malicious intellect.

Barney

As sinister as Lily was, Barney was the true master when it came to plotting and controlling the outcome of situations. The writer of books such as “The Bro Code” and “The Playbook” was surgical in his exploits of women and made it known from the get-go that there wasn’t anybody better at picking up chicks. Barney might not have been the typical gentleman, but he certainly dressed better than one and always had a trick up his sleeve in order to get out of any tight spots he found himself in.

Also, Barney played the part of a legal scapegoat for several years for GNB while actually being an FBI informant in order to get revenge on the guy who stole his very first girlfriend. That particular move and Barney’s intellect are legend… - wait for it - …dary.

Marshall

Judge-Fudge has entered the building - all rise. Marshall earns the spot on our list as the most intelligent character on How I Met Your Mother simply because of his career as a lawyer, then a judge, and then a member of the Supreme Court.

Going through law school and being a lawyer is ridiculously difficult, attaining a judgeship is even harder, and becoming a member of the Supreme Court is borderline impossible. But thanks to Marshall’s impeccable brain-power (remember when he wrote a 25-page paper in one night and still got a B- on it?) he can rest easy knowing that he’s the smartest member of the MacLaren’s Pub gang.