Counting triangles formula for the first Chern class of a circle bundle

We consider the problem of the combinatorial computation of the first Chern class of a circle bundle. N.Mnev found such a formula in terms of canonical shellings. It represents certain invariant of a triangulation computed by analyzing cyclic word in 3-character alphabet associated to the bundle. This curvature is a kind of discretization of Konstevich's curvature differential 2-form. We find a new expression of Mnev's curvature by counting triangles in a cyclic word. Our formula is different from that of Mnev. In particular, it is cyclically invariant by its very form. We present also some sample computations of this invariant and also provide a small Mathematica code for the computation of this invariant.