Here is a straightforward way to do it. There may be a more elegant method using an array formula but this works. Say your data starts in A1, and the two target values are in I1 and J1. Use column H as a helper column to test each row. So H1 would be:
This relies on your assumption that there are no duplicates of a value in a row. There are many ways to combine the double test. What I did here was to multiply the two counts. Each count can be only 0 or 1, so the multiplication produces a 1 only if both values are there. Copy this formula down column H for all of your data rows.
For the count you want, put this formula in your result cell:
Of course, adjust the range for the actual number of rows.