Something like this should work:
library(ggplot2)
library(plyr)
line_size <- count(factor(mtcars$gear))
ggplot(mtcars, aes(x = mpg, y = hp, colour = factor(gear), size=factor(gear))) +
geom_point(size=element_blank()) +
geom_smooth(method = lm, se = FALSE) +
scale_size_manual(values=line_size$freq/4)