The angle is a straight angle. Straight angles measure 180°.
1 angles is a right angle, which measures 90°. Another angle is 40°. Add that and subtract it from 180.

That means:

Switch it around and it becomes:

The sign changes when moved. First you were adding, now you're subtracting.

Divide both sides by 6

That means x = 8