O(N) vector model with twisted boundary conditions