Tricritical transition of the O(n) model in two dimensions