237A.md (1940B)
1 Source: https://codeforces.com/problemset/problem/237/A 2 3 A. Free Cash 4 5 time limit per test 6 7 2 seconds 8 9 memory limit per test 10 11 256 megabytes 12 13 input 14 15 stdin 16 17 output 18 19 stdout 20 21 Valera runs a 24/7 fast food cafe. He magically learned that next day *n* people will visit his cafe. For each person we know the arrival time: the *i*-th person comes exactly at *h**i* hours *m**i* minutes. The cafe spends less than a minute to serve each client, but if a client comes in and sees that there is no free cash, than he doesn't want to wait and leaves the cafe immediately. 22 23 Valera is very greedy, so he wants to serve all *n* customers next day (and get more profit). However, for that he needs to ensure that at each moment of time the number of working cashes is no less than the number of clients in the cafe. 24 25 Help Valera count the minimum number of cashes to work at his cafe next day, so that they can serve all visitors. 26 27 Input 28 29 The first line contains a single integer *n* (1 ≤ *n* ≤ 105), that is the number of cafe visitors. 30 31 Each of the following *n* lines has two space-separated integers *h**i* and *m**i* (0 ≤ *h**i* ≤ 23; 0 ≤ *m**i* ≤ 59), representing the time when the *i*-th person comes into the cafe. 32 33 Note that the time is given in the chronological order. All time is given within one 24-hour period. 34 35 Output 36 37 Print a single integer — the minimum number of cashes, needed to serve all clients next day. 38 39 Examples 40 41 Input 42 43 ``` 44 4 45 8 0 46 8 10 47 8 10 48 8 45 49 ``` 50 51 Output 52 53 ``` 54 2 55 ``` 56 57 Input 58 59 ``` 60 3 61 0 12 62 10 11 63 22 22 64 ``` 65 66 Output 67 68 ``` 69 1 70 ``` 71 72 Note 73 74 In the first sample it is not enough one cash to serve all clients, because two visitors will come into cafe in 8:10. Therefore, if there will be one cash in cafe, then one customer will be served by it, and another one will not wait and will go away. 75 76 In the second sample all visitors will come in different times, so it will be enough one cash.