added function to get current value of n while running