In a classroom there are $m$ students. During the month of July each of them visited the library at least once but none of them visited the library twice in the same day. It turned out that during the month of July each student visited the library a different number of times, furthermore for any two students $A$ and $B$ there was a day in which $A$ visited the library and $B$ did not and there was also a day when $B$ visited the library and $A$ did not do so. Determine the largest possible value of $m$.