#include <bits/stdc++.h>
using namespace std;
long long keta(long long x) {
  for (long long i = 0; i < 30; i++) {
    if (x < 10) {
      return i + 1;
    }
    x = x / 10;
  }
}
long long gcd(long long x, long long y) {
  long long aa = x, bb = y;
  for (long long i = 0; i < 1000; i++) {
    aa = aa % bb;
    if (aa == 0) {
      return bb;
    }
    bb = bb % aa;
    if (bb == 0) {
      return aa;
    }
  }
}
long long lcm(long long x, long long y) {
  long long aa = x, bb = y;
  for (long long i = 0; i < 1000; i++) {
    aa = aa % bb;
    if (aa == 0) {
      return x / bb * y;
    }
    bb = bb % aa;
    if (bb == 0) {
      return x / aa * y;
    }
  }
}
bool p(long long x) {
  if (x == 1) return false;
  for (long long i = 2; i < sqrt(x) + 1; i++) {
    if (x % i == 0 && x != i) {
      return false;
    }
  }
  return true;
}
long long max(long long a, long long b) {
  if (a >= b)
    return a;
  else
    return b;
}
string maxst(string second, string t) {
  long long n = second.size();
  long long m = t.size();
  if (n > m)
    return second;
  else if (n < m)
    return t;
  else {
    for (long long i = 0; i < n; i++) {
      if (second[i] > t[i]) return second;
      if (second[i] < t[i]) return t;
    }
    return second;
  }
}
long long min(long long a, long long b) {
  if (a >= b)
    return b;
  else
    return a;
}
long long n2[41];
long long nis[41];
long long nia[41];
long long mody[41];
long long nn;
long long com(long long n, long long y) {
  long long ni = 1;
  for (long long i = 0; i < 41; i++) {
    n2[i] = ni;
    ni *= 2;
  }
  long long bunsi = 1, bunbo = 1;
  for (long long i = 0; i < y; i++) bunsi = (bunsi * (n - i)) % 1000000007;
  for (long long i = 0; i < y; i++) bunbo = (bunbo * (i + 1)) % 1000000007;
  mody[0] = bunbo;
  for (long long i = 1; i < 41; i++) {
    bunbo = (bunbo * bunbo) % 1000000007;
    mody[i] = bunbo;
  }
  for (long long i = 0; i < 41; i++) nis[i] = 0;
  nn = 1000000007 - 2;
  for (long long i = 40; i >= 0; i -= 1) {
    if (nn > n2[i]) {
      nis[i]++;
      nn -= n2[i];
    }
  }
  nis[0]++;
  for (long long i = 0; i < 41; i++) {
    if (nis[i] == 1) {
      bunsi = (bunsi * mody[i]) % 1000000007;
    }
  }
  return bunsi;
}
long long gyakugen(long long n, long long y) {
  long long ni = 1;
  for (long long i = 0; i < 41; i++) {
    n2[i] = ni;
    ni *= 2;
  }
  mody[0] = y;
  for (long long i = 1; i < 41; i++) {
    y = (y * y) % 1000000007;
    mody[i] = y;
  }
  for (long long i = 0; i < 41; i++) nis[i] = 0;
  nn = 1000000007 - 2;
  for (long long i = 40; i >= 0; i -= 1) {
    if (nn > n2[i]) {
      nis[i]++;
      nn -= n2[i];
    }
  }
  nis[0]++;
  for (long long i = 0; i < 41; i++) {
    if (nis[i] == 1) {
      n = (n * mody[i]) % 1000000007;
    }
  }
  return n;
}
long long yakuwa(long long n) {
  long long sum = 0;
  for (long long i = 1; i < sqrt(n + 1); i++) {
    if (n % i == 0) sum += i + n / i;
    if (i * i == n) sum -= i;
  }
  return sum;
}
bool integer(long double n) {
  if (n == long(n))
    return true;
  else
    return false;
}
long long poow(long long y, long long n) {
  if (n == 0) return 1;
  n -= 1;
  long long ni = 1;
  for (long long i = 0; i < 41; i++) {
    n2[i] = ni;
    ni *= 2;
  }
  long long yy = y;
  mody[0] = yy;
  for (long long i = 1; i < 41; i++) {
    yy = (yy * yy) % 1000000007;
    mody[i] = yy;
  }
  for (long long i = 0; i < 41; i++) nis[i] = 0;
  nn = n;
  for (long long i = 40; i >= 0; i -= 1) {
    if (nn >= n2[i]) {
      nis[i]++;
      nn -= n2[i];
    }
  }
  for (long long i = 0; i < 41; i++) {
    if (nis[i] == 1) {
      y = (y * mody[i]) % 1000000007;
    }
  }
  return y;
}
long long minpow(long long x, long long y) {
  long long sum = 1;
  for (long long i = 0; i < y; i++) sum *= x;
  return sum;
}
long long ketawa(long long x, long long sinsuu) {
  long long sum = 0;
  for (long long i = 0; i < 100; i++)
    sum += (x % poow(sinsuu, i + 1)) / (poow(sinsuu, i));
  return sum;
}
long long sankaku(long long a) { return a * (a + 1) / 2; }
long long same(long long a[1111111], long long n) {
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    if (a[i] == a[i + 1]) {
      long long j = i;
      while (a[j + 1] == a[i] && j <= n - 2) j++;
      ans += sankaku(j - i);
      i = j;
    }
  }
  return ans;
}
bool search(long long x) {
  long long n;
  long long a[n];
  long long l = 0, r = n;
  while (r - l >= 1) {
    long long i = (l + r) / 2;
    if (a[i] == x)
      return true;
    else if (a[i] < x)
      l = i + 1;
    else
      r = i;
  }
  return false;
}
long long XOR(long long a, long long b) {
  long long ni = 1;
  for (long long i = 0; i < 41; i++) {
    n2[i] = ni;
    ni *= 2;
  }
  for (long long i = 0; i < 41; i++) nis[i] = 0;
  for (long long i = 40; i >= 0; i -= 1) {
    if (a >= n2[i]) {
      nis[i]++;
      a -= n2[i];
    }
    if (b >= n2[i]) {
      nis[i]++;
      b -= n2[i];
    }
  }
  long long sum = 0;
  for (long long i = 0; i < 41; i++) sum += (nis[i] % 2 * n2[i]);
  return sum;
}
struct UnionFind {
  vector<long long> par;
  UnionFind(long long N) : par(N) {
    for (long long i = 0; i < N; i++) par[i] = i;
  }
  long long root(long long x) {
    if (par[x] == x) return x;
    return par[x] = root(par[x]);
  }
  void unite(long long x, long long y) {
    long long rx = root(x);
    long long ry = root(y);
    if (rx == ry) return;
    par[rx] = ry;
  }
  bool same(long long x, long long y) {
    long long rx = root(x);
    long long ry = root(y);
    return rx == ry;
  }
};
long long a[314514];
long long cnt[314514][65];
long long sum[65];
long long ans[65];
signed main() {
  long long n;
  cin >> n;
  for (long long i = 0; i < n; i++) cin >> a[i];
  for (long long i = 0; i < n; i++)
    for (long long j = 0; j < 60; j++) cnt[i][j] = 0;
  for (long long i = 0; i < 60; i++) ans[i] = 0;
  for (long long i = 0; i < n; i++) {
    long long k = 1;
    for (long long j = 0; j < 60; j++) {
      if (a[i] % (k * 2) / k == 1) {
        cnt[i][j]++;
        sum[j]++;
      }
      k *= 2;
    }
  }
  for (long long i = 0; i < 60; i++)
    ans[i] = (sum[i] * (n - sum[i])) % 1000000007;
  long long answer = 0;
  long long l = 1;
  for (long long i = 0; i < 60; i++) {
    answer += l * ans[i];
    l *= 2;
    answer %= 1000000007;
  }
  cout << answer << endl;
}
