Equations

Two people X any Y have goats.X has more goats than Y.if Y gives X one of his goats, X will have twice as many goats as Y.If X gives Y one of his goats,they will have an equal number of goats.find how many goats each has.