Freedom and necessity in human activity