How to give the player a limited amount of moves?

How do I give the player a limited amount of moves? So if the player runs out of moves, a game over screen appears. My game is on a grid and only also horizontal and vertical movement. It also prevents the user from holding down to move.

{
public float moveSpeed = 5f;

public Transform movePoint;
public LayerMask whatStopsMovement;
public Animator anim;

    // Start is called before the first frame update
    void Start()
{
    movePoint.parent = null; // lets the Transform keep its local orientation rather than its global orientation
}

// Update is called once per frame
bool isCanMove = true;
void Update()
{
    transform.position = Vector3.MoveTowards(transform.position, movePoint.position, moveSpeed * Time.deltaTime);
    if (Vector3.Distance(transform.position, movePoint.position) <= .05f)
    {
        if (Mathf.Abs(Input.GetAxisRaw("Horizontal")) == 1f && isCanMove)
        {
            if (!Physics2D.OverlapCircle(movePoint.position + new Vector3(Input.GetAxisRaw("Horizontal"), 0f, 0f), .2f, whatStopsMovement))
            {
                movePoint.position += new Vector3(Input.GetAxisRaw("Horizontal"), 0f, 0f);
                isCanMove = false;
                StartCoroutine(WaitBeforeMove());
            }
        }
        else
        if (Mathf.Abs(Input.GetAxisRaw("Vertical")) == 1f && isCanMove)
        {
            if (!Physics2D.OverlapCircle(movePoint.position + new Vector3(0f, Input.GetAxisRaw("Vertical"), 0f), .2f, whatStopsMovement))
            {
                movePoint.position += new Vector3(0f, Input.GetAxisRaw("Vertical"), 0f);
                isCanMove = false;
                StartCoroutine(WaitBeforeMove());
            }
        }

        anim.SetBool("moving", false); // Checks whether the player is moving
    }
    else
    {
        anim.SetBool("moving", true);
    }
}
IEnumerator WaitBeforeMove()
{
    yield return new WaitForSeconds(1f); // Prevents user from holding down to move
    isCanMove = true;
}

public void OnTriggerEnter2D(Collider2D collider)
{
    Debug.Log("Trigger!");
}

}

What you can do is set up a timer what I mean is have a variable and make it so that whenever you move it goes up by one and when it reaches a certain number it disables the move key. Here is an example of a code.

public class Move : MonoBehaviour
{
   public int count;

   private void Start()
   {
       count = PlayerPrefs.GetInt("score", 0);
   }

    void Update()
    {
        if ("Player move")
        {
            count += 1;
        }
        if (count == 5)
            isCanMove = false;
    }
}

This is just an example iIdon’t think this code actually works but it shows the basic idea