<p>You are given a <strong>0-indexed</strong> integer array <code>nums</code> containing <strong>distinct</strong> numbers, an integer <code>start</code>, and an integer <code>goal</code>. There is an integer <code>x</code> that is initially set to <code>start</code>, and you want to perform operations on <code>x</code> such that it is converted to <code>goal</code>. You can perform the following operation repeatedly on the number <code>x</code>:</p>
<p>If <code>0 <= x <= 1000</code>, then for any index <code>i</code> in the array (<code>0 <= i < nums.length</code>), you can set <code>x</code> to any of the following:</p>
<ul>
<li><code>x + nums[i]</code></li>
<li><code>x - nums[i]</code></li>
<li><code>x ^ nums[i]</code> (bitwise-XOR)</li>
</ul>
<p>Note that you can use each <code>nums[i]</code> any number of times in any order. Operations that set <code>x</code> to be out of the range <code>0 <= x <= 1000</code> are valid, but no more operations can be done afterward.</p>
<p>Return <em>the <strong>minimum</strong> number of operations needed to convert </em><code>x = start</code><em> into </em><code>goal</code><em>, and </em><code>-1</code><em> if it is not possible</em>.</p>