Symmetries of discrete dynamical systems