#include <bits/stdc++.h>
using namespace std;
int res[1010110];
int n, m;
int x[1010];
int y[1010];
int main(int argc, const char* argv[]) {
  cin >> n >> m;
  for (int i = 0; i < m; ++i) {
    cin >> x[i] >> y[i];
  }
  for (int i = 1; i <= n; ++i) res[i] = 1;
  for (int i = 0; i < m; ++i) {
    for (int j = i + 1; j < m; ++j) {
      if (y[j] != y[i]) {
        long long dx = x[j] - x[i];
        long long dy = y[j] - y[i];
        if ((dx * y[i]) % dy != 0) continue;
        long long t = x[i] - (dx * y[i]) / dy;
        if (t <= 0 || t > n) continue;
        int cnt = 0;
        for (int k = 0; k < m; ++k) {
          if ((x[k] - x[i]) * (y[j] - y[i]) - (y[k] - y[i]) * (x[j] - x[i]) ==
              0) {
            ++cnt;
          }
        }
        res[t] = max(res[t], cnt);
      }
    }
  }
  int ans = 0;
  for (int i = 1; i <= n; ++i) ans += res[i];
  cout << ans;
  return 0;
}
