public void add(double d) {
		Double lows_max = lows.peek();
		Double highs_min = highs.peek();
		
		if (lows_max != null && highs_min != null) {
			if (d < lows_max) {
				lows.add(-d);
				lows_count++;
			} else {
				highs.add(d);
				highs_count++;
			}
		} else if (lows_max == null) {
			lows.add(-d);
			lows_count++;
		} else {
			highs.add(d);
			highs_count++;
		}
		
		int dif;
		dif = lows_count - highs_count;
		dif = dif < 0 ? -dif : dif;
		if ( dif > 1) {
			if (lows_count > highs_count) {
				highs.add(-lows.poll());
				lows_count--;
				highs_count++;
			} else {
				lows.add(-highs.poll());
				highs_count--;
				lows_count++;
			}
			
		}
		
	}