glsl count in fragment shader

Hello, i need color change of the rectangle for that I need to make a counter , how to do it ?
#version 430

out vec4 FragColor;

float counter = 0;

void main(){

    counter++;
    FragColor = vec4( 1,0,0,1 );
};

This count not work.

You need to use an atomic counter.