Changed variable name n to obs