count = 0; for (y = 2; y <= Bottom; y++) { if ([1,y] == [1,y-1]) { count++; } else { count = 1; } [2,y] = count; }