#include <bits/stdc++.h>
using namespace std;
long long cx[300], cy[300];
long long n, m, t1, t2, p, res;
map<long long, long long> mv;
int main() {
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    cin >> t1 >> t2;
    cx[i] = --t1;
    cy[i] = t2;
  }
  for (int i = 0; i < m; i++)
    for (int j = i + 1; j < m; j++) {
      if (cy[i] == cy[j] || cy[i] * (cx[j] - cx[i]) % (cy[j] - cy[i]) != 0)
        continue;
      p = cx[i] - cy[i] * (cx[j] - cx[i]) / (cy[j] - cy[i]);
      if (p >= 0 && p <= n - 1) {
        long long cnt = 0;
        for (int l = 0; l < m; l++) {
          if ((cx[j] - cx[i]) * (cy[l] - cy[i]) ==
              (cy[j] - cy[i]) * (cx[l] - cx[i]))
            cnt++;
        }
        mv[p] = max(mv[p], cnt);
      }
    }
  for (int i = 0; i < n; i++) {
    if (mv[i] == 0)
      res++;
    else
      res += mv[i];
  }
  cout << res << endl;
  return 0;
}
