#include <bits/stdc++.h>
using namespace std;
long long n, m, x[250], y[250], cnt[1000005];
void init() {
  cin >> n >> m;
  for (long long i = 0; i < m; i++) cin >> x[i] >> y[i];
}
void solve() {
  for (long long i = 1; i <= n; i++) cnt[i] = 1;
  for (long long i = 0; i < m; i++) {
    for (long long j = i + 1; j < m; j++) {
      long long a = (x[i] - x[j]) * y[i], b = (y[i] - y[j]),
                c = (y[i] - y[j]) * x[i];
      if (y[i] == y[j] || abs(c - a) % b != 0) continue;
      long long t = (c - a) / b;
      if (t < 1 || t > n) continue;
      long long count = 2;
      for (long long k = j + 1; k < m; k++) {
        if (y[k] == y[j] || y[k] == y[i]) continue;
        if ((y[k] - y[j]) * (x[i] - x[j]) == (x[k] - x[j]) * (y[i] - y[j]))
          count++;
      }
      cnt[t] = max(cnt[t], count);
    }
  }
  long long ans = 0;
  for (long long i = 1; i <= n; i++) ans += cnt[i];
  cout << ans << "\n";
}
int main() {
  init();
  solve();
}
