Hasse invariant of an algebra