#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>
T randint(T a, T b) {
  return uniform_int_distribution<T>(a, b)(rng);
}
string to_string(string s) { return '"' + s + '"'; }
string to_string(const char *s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "false"); }
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto &x : v) {
    if (!first) res += ", ";
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
bool cmp(pair<long long, long long> A, pair<long long, long long> B) {
  long long a, b;
  a = (long long)A.first * (long long)B.second;
  b = (long long)B.first * (long long)A.second;
  return a < b;
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  long long n, m, a, b;
  cin >> n >> m;
  vector<pair<long long, long long> > A;
  for (long long i = 0; i < m; i++) {
    cin >> a >> b;
    A.push_back({a, b});
  }
  vector<long long> count(n + 1, 1);
  for (long long i = 0; i < m; i++) {
    for (long long j = i + 1; j < m; j++) {
      long long x1 = A[i].first, y1 = A[i].second, x2 = A[j].first,
                y2 = A[j].second;
      long long num = (x1 - x2) * y1;
      if ((y1 == y2) || ((abs(num) % (abs(y2 - y1))) != 0)) continue;
      long long l = num / (y2 - y1);
      l += x1;
      if (l <= 0 || l > n) continue;
      long long cnt = 2;
      for (long long k = 0; k < m; k++) {
        if (k == i || k == j) continue;
        long long x = A[k].first, y = A[k].second;
        if ((y - y1) * (x2 - x1) == (y2 - y1) * (x - x1)) cnt++;
      }
      count[l] = max(count[l], cnt);
    }
  }
  long long ans = 0;
  for (long long i = 1; i <= n; i++) ans += count[i];
  cout << ans;
}
