Dan Edmonds, Test Prep and College Admissions Expert
While you certainly don't need to be a straight A student to get into Harvard, it can be very difficult to overcome a bad grade in a core academic course like math, especially a failing grade. A lot would depend on the context. Was it only for one semester? Were all your other math grades A's? If so, it might be something you could overcome.
If there was a very good reason for the poor grade-- that is, something happened that semester that really negatively impacted you and made it difficult for you to perform to your ability-- you might be able to provide what's called an addendum, which is a brief statement explaining what led to the poor grade that semester, and why that grade isn't indicative of your academic ability.
Ultimately, Harvard considers your entire application. If all your other grades, your course selection, your SAT scores, you extra-curricular activities, your essay, your recommendations, and your achievements are outstanding, it's possible you could get in despite one F one semester.
But I'd consider you a long shot candidate for a school like Harvard unless everything else about your application is really outstanding and compelling.