public void printpaint() {
    int[] is = new int[8001];
    int last = -1;
    for( int i = 0;i < lptr.size();i++) {
      Pointer p = lptr.get(i);
      if( p.r == 0 ) continue;
      if ( p.color == -1 ) { last = -1; continue;}
      if ( last != p.color ) {
        is[p.color]++;
        last = p.color;
      }
    }

    for( int i = 0;i < 8001;i++) {
      if ( is[i] != 0) {
        System.out.println("" + i + " " + is[i]);
      }
    }
  }