Terahertz collective dynamics of DNA as affected by hydration and counterions