#include <bits/stdc++.h>
using namespace std;
inline int lowbit(int n) { return n & (-n); }
long long x[100000];
long long y[100000];
int ans[1000000 + 10];
int main() {
  int n, m;
  while (cin >> n >> m) {
    fill(ans, ans + n + 1, 1);
    for (int i = 1; i <= m; ++i) {
      cin >> x[i] >> y[i];
    }
    for (int i = 1; i <= m; ++i) {
      for (int j = i + 1; j <= m; ++j) {
        if (y[i] == y[j]) continue;
        if (-y[i] * (x[j] - x[i]) % (y[j] - y[i]) != 0) continue;
        long long now = -y[i] * (x[j] - x[i]) / (y[j] - y[i]) + x[i];
        if (now < 1 || now > n) continue;
        int tmp = 0;
        for (int k = 1; k <= m; ++k) {
          if ((y[k] - y[i]) * (x[j] - x[i]) == (x[k] - x[i]) * (y[j] - y[i])) {
            ++tmp;
          }
        }
        ans[now] = max(ans[now], tmp);
      }
    }
    long long res = 0;
    for (int i = 1; i <= n; ++i) {
      res += ans[i];
    }
    cout << res << endl;
  }
  return 0;
}
