in this picture: there are 6 intersection points. I need 6 auto change when number of intersection points change. Can you help me? 
my code:
\documentclass[tikz,border=5mm]{standalone} \usepackage[utf8]{vietnam} \usetikzlibrary{intersections} \begin{document} \begin{tikzpicture}[smooth] \draw[gray!30](-3,-3) grid (3,3); \draw[->](-3,0)--(3,0) node[below]{$x$}; \draw[->](0,-3)--(0,3) node[right]{$y$}; \draw[blue,name path=hamso] plot[domain=-2.1:2.1] (\x,{(\x)^3-3*(\x)}) node[right, red] {$y=x^3-3x$}; \draw[red,name path=tron] (0,0) circle(2); \fill[violet,name intersections={of=hamso and tron,name=A,total=\t}] \foreach \i in {1,...,\t} {(A-\i) circle (2pt) node[above]{\i}}; \path (current bounding box.south) node[below]{There are: \fbox{6} intersection points}; \end{tikzpicture} \end{document} 

total=\t, so just write\fbox{\t}.\fbox{\t}do not work. May betotal=\tis locally deffined only.