How can I set virtual presence sensor with a routine?

Don’t think you can with a routine.

I want to arm the alarm system when iPhone 1&2 leave.

And disarm the alarm system when iPhone 1 OR 2 arrive.