The joints problem in R^n

We show that given a collection of A lines in \R^n, n\geq 2, the maximum number of their joints (points incident to at least n lines whose directions form a linearly independent set) is O(A^{n/(n-1)}). An analogous result for smooth algebraic curves is also proven.