#include <bits/stdc++.h>
using namespace std;
struct point {
  long double x;
  long double y;
};
int ans[1000001];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long double n, m;
  cin >> n >> m;
  vector<point> ps;
  point p;
  for (int i = 0; i < m; i++) {
    cin >> p.x >> p.y;
    ps.push_back(p);
  }
  map<long double, int> hehe;
  map<long double, int>::iterator it;
  long double kli;
  int ind;
  for (int i = 0; i < m; i++) {
    hehe.clear();
    for (int j = i + 1; j < m; j++) {
      if (ps[i].y - ps[j].y != 0) {
        kli = ((ps[i].y * ps[j].x) - (ps[j].y * ps[i].x)) / (ps[i].y - ps[j].y);
        if (fabs(kli - round(kli)) <= 0.000000000001) {
          kli = round(kli);
        } else {
          continue;
        }
        if ((kli <= 1000000) && (kli >= 1)) {
          hehe[kli]++;
          if (hehe[kli] == 1) {
            hehe[kli]++;
          }
        }
      }
    }
    it = hehe.begin();
    while (it != hehe.end()) {
      ind = (int)(round(it->first));
      if ((ind <= 1000000) && (ind >= 1)) {
        ans[ind] = max(it->second, ans[ind]);
      }
      it++;
    }
  }
  long long res = 0;
  for (int i = 1; i <= n; i++) {
    res += max(1, ans[i]);
  }
  cout << res << endl;
}
