long find(int n, boolean[][] grid, int x, int y, int remaining) {
    
        if (x == 1 && y == 0) return remaining == 0 ? 1 : 0;
        if (x < 0 || x >= n) return 0;
        if (y < 0 || y >= n) return 0;
        if (grid[x][y]) return 0;
        
        long count = 0;
        
        grid[x][y] = true;
        count += find(n, grid, x + 1, y, remaining - 1);
        count += find(n, grid, x - 1, y, remaining - 1);
        count += find(n, grid, x, y + 1, remaining - 1);
        count += find(n, grid, x, y - 1, remaining - 1);
        grid[x][y] = false;

        return count;
    }