#include <bits/stdc++.h>
using namespace std;
const int N = 300;
const double eps = 1e-9;
const int oo = 1000000000;
int n, m, f[1100000];
pair<int, int> pnt[N];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; ++i) {
    scanf("%d%d", &pnt[i].first, &pnt[i].second);
  }
  for (int i = 1; i <= n; ++i) {
    f[i] = 1;
  }
  for (int i = 0; i < m; ++i) {
    for (int j = i + 1; j < m; ++j)
      if (pnt[i].second != pnt[j].second) {
        if ((long long)pnt[i].second * (pnt[i].first - pnt[j].first) %
                (pnt[i].second - pnt[j].second) ==
            0) {
          long long k = pnt[i].first - (long long)pnt[i].second *
                                           (pnt[i].first - pnt[j].first) /
                                           (pnt[i].second - pnt[j].second);
          if (k >= 1 && k <= n) {
            int q = 0;
            for (int l = 0; l < m; ++l)
              if ((long long)(pnt[i].first - pnt[j].first) *
                      (pnt[i].second - pnt[l].second) ==
                  (long long)(pnt[i].first - pnt[l].first) *
                      (pnt[i].second - pnt[j].second)) {
                ++q;
              }
            f[k] = max(f[k], q);
          }
        }
      }
  }
  int ans = 0;
  for (int i = 1; i <= n; ++i) {
    ans = ans + f[i];
  }
  cout << ans << endl;
  return 0;
}
