#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000 * 1000 + 100;
long long ans[maxn];
vector<pair<long long, long long> > flam;
bool mos(long long a, long long b, long long c, long long d) {
  if (a * d == b * c) return true;
  return false;
}
int main() {
  int n, f;
  cin >> n >> f;
  for (int i = 0; i < f; i++) {
    int a, b;
    cin >> a >> b;
    flam.push_back(make_pair(a, b));
  }
  for (int i = 0; i < f; i++) {
    for (int j = 0; j < f; j++) {
      if (i == j) continue;
      long long x1 = flam[i].first;
      long long y1 = flam[i].second;
      long long x2 = flam[j].first;
      long long y2 = flam[j].second;
      if (x1 == x2) {
        if (x1 > n) continue;
        long long res = 0;
        for (int c = 0; c < f; c++)
          if (flam[c].first == x1) res++;
        ans[x1] = max(ans[x1], res);
        continue;
      }
      if (y1 == y2) continue;
      if ((y1 * ((x2 - x1))) % ((y2 - y1)) != 0) continue;
      long long X = x1 - ((y1 * ((x2 - x1))) / ((y2 - y1)));
      if (X > n || X < 0) continue;
      long long res = 1;
      for (int c = 0; c < f; c++) {
        if (flam[c].first == x1) continue;
        if (mos((flam[c].second - y1), (flam[c].first - x1), y2 - y1,
                x2 - x1) == true) {
          res++;
        }
      }
      ans[X] = max(ans[X], res);
    }
  }
  int sum = 0;
  for (int i = 1; i <= n; i++) {
    if (ans[i] == 0 && f > 0) ans[i] = 1;
    sum += ans[i];
  }
  cout << sum << endl;
}
