Using the inverse alpha in shader?

Hello, how can I specify the inverse of the alpha of a texture?

For example, this is what I would think would be possible intuitively, but it doesn’t work:

fixed4 tex = tex2D(_MainTex, IN.uv_MainTex);
          
o.Albedo = _Color * ~tex.a;

The alpha the channel has dimensionality from 0 to 1. So if you want to invert only an alpha the channel, it is probably better to write:

 o.Albedo = tex.rgb;
 o.Alpha = (1 - tex.a);

As it is surface shader, on how many I see, you shall add also component alpha, for example:

 #pragma surface surf Lambert alpha

And use tags:

 Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}