Let f: M -> R be an analytic proper function defined in a neighbourhood of a closed "regular" (for instance semi-analytic or sub-analytic) set P subset of f(-1)(y). We show that the set of non-trivial trajectories of the equation = del f(x) attracted by P has the same Cech-Alexander cohomology groups as Omega n {f < y}, where Omega is an appropriately choosen neighbourhood of P. There are also given necessary conditions for existence of a trajectory joining two closed "regular" subsets of M.