  Let $n$ be a positive integer and let $A$ be nonempty finite set of positive
integers. We say that $A$ is relatively prime if $\gcd(A) =1$ and that $A$ is
relatively prime to $n$ if $\gcd(A,n)=1$. In this work we count the number of
nonempty subsets of $A$ which are relatively prime and the number of nonempty
subsets of $A$ which are relatively prime to $n$. Related formulas are also
obtained for the number of such subsets having some fixed cardinality. This
extends previous work for the cases where $A$ is an interval or a set in
arithmetic progression. Applications include: a) An exact formula is obtained
for the number of elements of $A$ which are co-prime to $n$; note that this
number is $\phi(n)$ if $A=[1,n]$. b) Algebraic characterizations are found for
a nonempty finite set of positive integers to have elements which are all
pairwise co-prime and consequently a formula is given for the number of
nonempty subsets of $A$ whose elements are pairwise co-prime. c) We provide
combinatorial formulas involving Mertens function.
