How to formulate this optimization problem

This is not convex (even if you relax the integer constraints.)
FAQ: Why doesn’t CVX accept my problem? [READ THIS FIRST]