Showing the number of LED blink on display

Hai, how can I modify my code so that my 7-segment display can show the number of led blinking respectively? Sorry for using the simplest and dumb code to show my number on the display, it's quite long. :disappointed_relieved: Both displays always show me 0 and 6 only. I know this code is controlling the display simultaneously, any idea to let the left one shows the number of blinking of red LED and the right one for the blue LED? How can I make my LDR detects a change when my LED is blinking and adds to the count of LED blinking?

//#include <SevSeg.h>
const int LED_red = 12;
const int LED_blue = 13;
const int blue = A0;
const int red = A1;
int countRED = 0;
int countBLUE = 0;

void setup()
{
  pinMode (LED_red, OUTPUT);
  pinMode (LED_blue, OUTPUT);
  
  pinMode (red, INPUT);
  pinMode (blue, INPUT);
  
pinMode(2, OUTPUT); //a
pinMode(3, OUTPUT); //b
pinMode(4, OUTPUT); //c
pinMode(5, OUTPUT); //d
pinMode(6, OUTPUT); //e
pinMode(7, OUTPUT); //f
pinMode(8, OUTPUT); //g
Serial.begin(9600); // Monitor
}

void loop()
{
  digitalWrite(random(12,14),HIGH);
  delay(3000);
  digitalWrite (LED_blue, LOW);
  digitalWrite (LED_red, LOW);
  delay(1000);
  
  zero();
  countRED = map(countRED, 410, 640, 0, 9);
  countRED = analogRead(red); 
  Serial.println(countRED); 
  countBLUE = map(countBLUE, 410, 640, 0, 9);
  countBLUE = analogRead(blue); 
  Serial.println(countBLUE);
  
  if(countRED==0 || countBLUE==0 ){zero();}
  if(countRED==1 || countBLUE==1 ){one();}
  if(countRED==2 || countBLUE==2 ){two();}
  if(countRED==3 || countBLUE==3){three();}
  if(countRED==4 || countBLUE==4 ){four();}
  if(countRED==5 || countBLUE==5){five();}
  if(countRED==6 || countBLUE==6){six();}
  if(countRED==7 || countBLUE==7){seven();}
  if(countRED==8 || countBLUE==8){eight();}
  if(countRED==9 || countBLUE==9){nine();}
}
void one(){
  	digitalWrite(2, HIGH); 
    digitalWrite(3, LOW); 
    digitalWrite(4, LOW); 
  	digitalWrite(5, HIGH);
    digitalWrite(6, HIGH);  
    digitalWrite(7, HIGH); 
    digitalWrite(8, HIGH);
    delay(2000);
    digitalWrite(2, HIGH); 
    digitalWrite(3, HIGH); 
    digitalWrite(4, HIGH);
    digitalWrite(5, HIGH); 
    digitalWrite(6, HIGH); 
    digitalWrite(7, HIGH); 
    digitalWrite(8, HIGH); 
 
}

void two(){
  	digitalWrite(2, LOW); 
    digitalWrite(3, LOW); 
   	digitalWrite(4, HIGH);
    digitalWrite(5, LOW); 
    digitalWrite(6, LOW); 
  	digitalWrite(7, HIGH); 
    digitalWrite(8, LOW); 
    delay(2000);
    digitalWrite(2, HIGH); 
    digitalWrite(3, HIGH); 
    digitalWrite(4, HIGH);
    digitalWrite(5, HIGH); 
    digitalWrite(6, HIGH); 
    digitalWrite(7, HIGH); 
    digitalWrite(8, HIGH); 
}
void three(){
    digitalWrite(2, LOW); 
    digitalWrite(3, LOW); 
    digitalWrite(4, LOW); 
    digitalWrite(5, LOW); 
  	digitalWrite(6, HIGH); 
    digitalWrite(7, HIGH); 
    digitalWrite(8, LOW); 
    delay(2000);
    digitalWrite(2, HIGH); 
    digitalWrite(3, HIGH); 
    digitalWrite(4, HIGH);
    digitalWrite(5, HIGH); 
    digitalWrite(6, HIGH); 
    digitalWrite(7, HIGH); 
    digitalWrite(8, HIGH); 
}
void four(){
  	digitalWrite(2, HIGH);
    digitalWrite(3, LOW); 
    digitalWrite(4, LOW);
  	digitalWrite(5, HIGH); 
    digitalWrite(6, HIGH); 
    digitalWrite(7, LOW); 
    digitalWrite(8, LOW); 
    delay(2000);
    digitalWrite(2, HIGH); 
    digitalWrite(3, HIGH); 
    digitalWrite(4, HIGH);
    digitalWrite(5, HIGH); 
    digitalWrite(6, HIGH); 
    digitalWrite(7, HIGH); 
    digitalWrite(8, HIGH); 
}
void five(){
    digitalWrite(2, LOW); 
  	digitalWrite(3, HIGH); 
    digitalWrite(4, LOW);
    digitalWrite(5, LOW);
  	digitalWrite(6, HIGH); 
    digitalWrite(7, LOW); 
    digitalWrite(8, LOW); 
    delay(2000);
    digitalWrite(2, HIGH); 
    digitalWrite(3, HIGH); 
    digitalWrite(4, HIGH);
    digitalWrite(5, HIGH); 
    digitalWrite(6, HIGH); 
    digitalWrite(7, HIGH); 
    digitalWrite(8, HIGH); 
}
void six(){
    digitalWrite(2, LOW);
  	digitalWrite(3, HIGH);
    digitalWrite(4, LOW);
    digitalWrite(5, LOW); 
    digitalWrite(6, LOW); 
    digitalWrite(7, LOW); 
    digitalWrite(8, LOW); 
    delay(2000);
    digitalWrite(2, HIGH); 
    digitalWrite(3, HIGH); 
    digitalWrite(4, HIGH);
    digitalWrite(5, HIGH); 
    digitalWrite(6, HIGH); 
    digitalWrite(7, HIGH); 
    digitalWrite(8, HIGH); 
}
void seven(){
   digitalWrite(2, LOW); 
   digitalWrite(3, LOW); 
   digitalWrite(4, LOW);
  	digitalWrite(5, HIGH); 
   digitalWrite(6, HIGH); 
   digitalWrite(7, HIGH); 
   digitalWrite(8, HIGH);
   delay(2000);
   digitalWrite(2, HIGH); 
   digitalWrite(3, HIGH); 
   digitalWrite(4, HIGH);
   digitalWrite(5, HIGH); 
   digitalWrite(6, HIGH); 
   digitalWrite(7, HIGH); 
   digitalWrite(8, HIGH); 
}

void eight(){
    digitalWrite(2, LOW); 
    digitalWrite(3, LOW); 
    digitalWrite(4, LOW); 
    digitalWrite(5, LOW);
    digitalWrite(6, LOW);  
    digitalWrite(7, LOW); 
    digitalWrite(8, LOW); 
  	delay(2000);
  	digitalWrite(2, HIGH); 
    digitalWrite(3, HIGH); 
    digitalWrite(4, HIGH);
    digitalWrite(5, HIGH); 
    digitalWrite(6, HIGH); 
    digitalWrite(7, HIGH); 
    digitalWrite(8, HIGH); 
}
void nine(){
    digitalWrite(2, LOW); 
    digitalWrite(3, LOW); 
    digitalWrite(4, LOW); 
    digitalWrite(5, LOW);
  	digitalWrite(6, HIGH); 
    digitalWrite(7, LOW);  
    digitalWrite(8, LOW);
  	delay(2000);
    digitalWrite(2, HIGH); 
   digitalWrite(3, HIGH); 
   digitalWrite(4, HIGH);
   digitalWrite(5, HIGH); 
   digitalWrite(6, HIGH); 
   digitalWrite(7, HIGH); 
   digitalWrite(8, HIGH); 
}
void zero(){
  	digitalWrite(2, LOW); 
    digitalWrite(3, LOW); 
    digitalWrite(4, LOW); 
    digitalWrite(5, LOW);
    digitalWrite(6, LOW); 
    digitalWrite(7, LOW); 
  	digitalWrite(8, HIGH);  
  	delay(2000);
    digitalWrite(2, HIGH); 
    digitalWrite(3, HIGH); 
    digitalWrite(4, HIGH);
    digitalWrite(5, HIGH); 
    digitalWrite(6, HIGH); 
    digitalWrite(7, HIGH); 
  	digitalWrite(8, HIGH);
}

What do your serial prints tell you?

it prints 54 when dim, 974 when bright in the simulator