How to make count in join
The simplest way would be to use a subquery:

SELECT count(*) AS user_count FROM
(
    -- Original query, untouched
    SELECT
        user.id,
        COUNT( DISTINCT usp.user_id) AS user_sub_plans
    FROM user
    RIGHT JOIN user_preferences AS up ON up.user_id = user.id
    LEFT JOIN user_subscription_plan AS usp ON usp.user_id = user.id
    AND user.inactive = 0
    GROUP BY 1
    -- end of original query
) AS original_query
WHERE user_sub_plans &gt;= 1;


If you use recent version of MySQL, you can also use the WITH construct if it looks simpler to you:

WITH original_query AS ( -- original query ...)
SELECT count(*) AS user_count
FROM original_query
WHERE user_sub_plans &gt;= 1;


Given you want to do a nested count, I don't see an obvious way to do it without a subquery/WITH (nested querying). However, if you would only want to filter our some columns, without counting again, you can use HAVING, which is basically a post-GROUP BY, late executing WHERE:

SELECT
    user.id,
    COUNT( DISTINCT usp.user_id) AS user_sub_plans
    ...
    GROUP BY ...
    HAVING user_sub_plans &gt;= 1;


Outside of your query, there are a couple of not-wrong-but-weird decisions you took, like the RIGHT JOIN, and the AND user.inactive = 0 as part of the ON clause. I am not saying those are bad, but pointing you to double check those are things you want to do, and not unintentional bugs.