I read about it on Investopedia, Wikipedia and IRS sites.
Their examples are too easy and do not look similar to my case.
I mean that even that I bought some shares higher then the price i sold it but average price per share was less.