On monomial algebras of finite global dimension