#include <bits/stdc++.h>
using namespace std;
using lld = int64_t;
using llu = uint64_t;
using llf = long double;
using PII = pair<int, int>;
using PIL = pair<int, lld>;
using PLI = pair<lld, int>;
using PLL = pair<lld, lld>;
using PIB = pair<int, bool>;
using PBI = pair<bool, int>;
template <typename T>
using maxHeap = priority_queue<T, vector<T>, less<T>>;
template <typename T>
using minHeap = priority_queue<T, vector<T>, greater<T>>;
template <typename Iter>
ostream& _out(ostream& s, Iter b, Iter e) {
  s << "[";
  for (auto it = b; it != e; it++) s << (it == b ? "" : " ") << *it;
  s << "]";
  return s;
}
template <typename A, typename B>
ostream& operator<<(ostream& s, const pair<A, B>& p) {
  return s << "(" << p.first << "," << p.second << ")";
}
template <typename T>
ostream& operator<<(ostream& s, const vector<T>& c) {
  return _out(s, begin(c), end(c));
}
bool debug = 0;
template <typename T>
void DEBUG(const T& x) {
  if (debug) cerr << x;
}
template <typename T, typename... Args>
void DEBUG(const T& head, const Args&... tail) {
  if (debug) {
    cerr << head;
    DEBUG(tail...);
  }
}
const int N = 1000000 + 5;
const int K = 250 + 5;
lld x[K], y[K];
int cnt[N];
int main(int argc, char* argv[]) {
  if (argc > 1 and string(argv[1]) == "-D") debug = 1;
  if (!debug) {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
  }
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < k; i++) cin >> x[i] >> y[i];
  fill(cnt, cnt + N, 1);
  for (int i = 0; i < k; i++)
    for (int j = i + 1; j < k; j++) {
      if (y[i] == y[j]) continue;
      if (y[j] * (x[i] - x[j]) % (y[i] - y[j]) != 0) continue;
      lld X = -y[j] * (x[i] - x[j]) / (y[i] - y[j]) + x[j];
      if (0 > X or X > n) continue;
      int cur = 2;
      for (int a = j + 1; a < k; a++)
        cur += (x[i] - x[j]) * (y[a] - y[j]) == (x[a] - x[j]) * (y[i] - y[j]);
      cnt[X] = max(cnt[X], cur);
    }
  int ans = 0;
  for (int i = 1; i <= n; i++) ans += cnt[i];
  cout << ans << '\n';
  return 0;
}
