#include <bits/stdc++.h>
using namespace std;
struct Tpoint {
  long long x, y;
  Tpoint() {}
  Tpoint(int a, int b) {
    x = a + 0ll;
    y = b + 0ll;
  }
};
long long area2(Tpoint a, Tpoint b, Tpoint c) {
  return ((b.x - a.x) * (c.y - a.y) - (c.x - a.x) * (b.y - a.y));
}
Tpoint flgs[300];
int n, m;
int maoff[1000000 + 123];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    flgs[i] = Tpoint(x, y);
  }
  for (int i = 1; i <= n; ++i) maoff[i] = 1;
  for (int i = 0; i < m; ++i)
    for (int j = i + 1; j < m; ++j) {
      int summ = 0;
      for (int k = 0; k < m; ++k)
        if (area2(flgs[i], flgs[j], flgs[k]) == 0) summ++;
      if (flgs[i].y != flgs[j].y) {
        if ((flgs[i].y * (flgs[j].x - flgs[i].x)) % (flgs[i].y - flgs[j].y) ==
            0) {
          long long tx =
              (flgs[j].x - flgs[i].x) * flgs[i].y / (flgs[i].y - flgs[j].y) +
              flgs[i].x;
          if (tx >= 1 && tx <= n && summ > maoff[tx]) maoff[tx] = summ;
        }
      }
    }
  int ans = 0;
  for (int i = 1; i <= n; ++i) ans += maoff[i];
  printf("%d\n", ans);
  return 0;
}
