Changed hardcoded length value to n