#include <bits/stdc++.h>
using namespace std;
long long n, m, ans, t1, t2, t3, t, it, c1, c2;
long long x[255], y[255], v[1000005];
pair<long long, double> p[1000005];
map<long long, long long> check;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> m;
  for (int i = 0; i < m; i++) cin >> x[i] >> y[i];
  for (int i = 0; i < m; i++)
    for (int j = 0; j < m; j++)
      if (i - j) {
        t1 = x[i] * y[j] - x[j] * y[i];
        t2 = y[j] - y[i];
        t3 = x[j] - x[i];
        if (t2 and t1 / t2 > 0 and t1 / t2 <= n and t1 % t2 == 0) {
          p[it++] = {t1 / t2, t3 / (t2 * 1.0)};
        }
      }
  sort(p, p + it);
  c1 = 0;
  c2 = 1;
  for (int i = 1; i < it; i++) {
    if (p[i].first == p[i - 1].first) {
      if (p[i].second == p[i - 1].second)
        c2++;
      else {
        c1 = max(c2, c1);
        c2 = 1;
      }
    } else {
      v[p[i - 1].first] = max(c1, c2);
      c1 = 0;
      c2 = 1;
    }
  }
  if (it) v[p[it - 1].first] = max(c1, c2);
  for (int i = 1; i <= m; i++) check[i * (i - 1)] = i;
  for (int i = 1; i <= n; i++) {
    ans += check[v[i]];
  }
  cout << ans;
  return 0;
}
