4.23 Given an expression, how to find all variables and functions in it?

Given say \(\frac {d^{2}}{d x^{2}}y \left (x \right )+n \left (\frac {d}{d x}y \left (x \right )\right )+3 = \sin \left (x \right )\) how to find all variables and functions in it, not including math functions such as \(\sin x\)?

So the result should be \(n,x,y(x)\).

ode:=diff(y(x),x$2)+n*diff(y(x),x)+3=sin(x); 
vars:=indets(ode, Or(  And(symbol,Not(constant)), And(function,Not(typefunc(mathfunc)) ) )) 
 
#gives 
#           vars := {n, x, diff(y(x), x), diff(y(x), x, x), y(x)}
 

I still need to work on excluding derivatives from the search.