#include <bits/stdc++.h>
using namespace std;
struct node {
  long long x;
  long long y;
} p[250];
long long ans[1000009];
int main(void) {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) ans[i] = 1;
  for (int i = 0; i < m; i++) {
    cin >> p[i].x >> p[i].y;
  }
  for (int i = 0; i < m; i++) {
    for (int j = i + 1; j < m; j++) {
      if (p[i].y == p[j].y) continue;
      if ((p[j].x - p[i].x) * p[i].y % (p[j].y - p[i].y) != 0) continue;
      long long t = p[i].x - (p[j].x - p[i].x) * p[i].y / (p[j].y - p[i].y);
      if (t <= 0 || t > n) continue;
      long long tmp = 0;
      for (int k = 0; k < m; k++)
        if ((p[i].x - p[k].x) * (p[j].y - p[k].y) ==
            (p[j].x - p[k].x) * (p[i].y - p[k].y))
          tmp++;
      ans[t] = max(ans[t], tmp);
    }
  }
  long long ans2 = 0;
  for (int i = 1; i <= n; i++) ans2 += ans[i];
  cout << ans2 << endl;
  return 0;
}
